Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add date to logs #844

Open
masterfelu opened this issue Apr 3, 2024 · 2 comments
Open

add date to logs #844

masterfelu opened this issue Apr 3, 2024 · 2 comments

Comments

@masterfelu
Copy link

the time is only output for the logs, the date isn't

bash-5.1$ python3 -m caproto.ioc_examples.simple
[I 12:57:53.225       server:  152] Asyncio server starting up...
[I 12:57:53.225       server:  159] Listening on 0.0.0.0:59107
[I 12:57:53.226       server:  196] Server startup complete.

it is useful for scripts running for a long time.

@danielballan
Copy link
Collaborator

Hello @masterfelu!

The logs are configurable: https://caproto.github.io/caproto/v1.1.1/loggers.html#caproto-s-logging-related-api

There is a trade off between horizontal space and including the date. I can appreciate the argument for including it by default. I am interested in what others would think.

@masterfelu
Copy link
Author

The logs are configurable: https://caproto.github.io/caproto/v1.1.1/loggers.html#caproto-s-logging-related-api

I added the lines as per the document to enable date on the logs before run my IOC

ioc = MyIOC(**ioc_options)
config_caproto_logging(datefmt="%Y-%m-%d %H:%M:%S")
run(ioc.pvdb, **run_options)

but I still don't get the date. I also tried to manually change the logging.basicConfig or ioc.log variable, but still the IOC ends up using the default logger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants