aiologger icon indicating copy to clipboard operation
aiologger copied to clipboard

Where an aio-logger output at systemd?

Open leichgardt opened this issue 4 years ago • 1 comments
trafficstars

I'm trying to use aiologger in my service but I don't see the output of AsyncStreamHandler into $ journalctl -u my.service. When I was running my project $ python main.py of course I could see the logger output.

What do I need to do for journalctl aio-logging?

system: ubuntu 20.04 python: 3.8

leichgardt avatar May 24 '21 17:05 leichgardt

I'm having problems also with aiologger and journald. Using a simple example:

import asyncio
from aiologger import Logger


async def main():
    logger = Logger.with_default_handlers(name='my-logger')

    count=0
    while count<10:
        await logger.info(f"{count}")
        count+=1

    await logger.shutdown()


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

And run it with systemd:

systemd-run ./log.py

I see the first 0, but the rest of attempts to log give an error:

pipe closed by peer or os.write(pipe, data) raised exception.

The application I'm working on freezees when calling the logger. But I didn't manage to produce a simple example to reproduce it.

Can it be related to #4.

meskio avatar Dec 21 '22 17:12 meskio