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

Allow configuration of logger via config file #45

Closed
eiborgrepus opened this Issue Feb 17, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@eiborgrepus
Copy link

eiborgrepus commented Feb 17, 2017

As far as I can see the only way to set the log level to debug is to do this via the -D LOG_LEVEL option at application startup. The log level will then be set application wide. Also the message format is fixed. Libraries used in application won't adhere to this format though since they do not use the ha.log function.

I would prefer to have my logging configuration in a file read from a configuration directory, then use the python logging logger directly rather than the ha.log function as libraries do.

I therefore suggest reading the configuration of the logger from a logging.cfg file that is placed in a standard location (i.e /home/userdir/.appdaemon followed by /etc/appdaemon on a Linux box). If there is no such file a basic configuration can be set up programmatically. A new command line argument can be put into place to change the configuration directory to an arbitrary location and a sample logging.cfg can be shared or written on startup to the user's home directory if there is no other such file in the system so far.

Do you think this way of configuring the logger fits into the project? If so, I can of course help you with the necessary changes.

@yawor

This comment has been minimized.

Copy link
Contributor

yawor commented Feb 22, 2017

Take a look at my PR #40. I've made some changes to the logging which allow at least configuring message format. I didn't want to change too much because people's apps are already using existing log method.

@eiborgrepus

This comment has been minimized.

Copy link
Author

eiborgrepus commented Feb 23, 2017

Hi yawor, I very much appreciate your changes. :-)

I think ha.log should remain in the source code since you're right: people use it (although they shouldn't be forced to). Nevertheless I think the project might benefit from a more standard way to set things up. Once there is a configuration directory for example it's only a small step to have separate configuration files for individual apps. The logging.cfg is just a start.

@acockburn

This comment has been minimized.

Copy link
Collaborator

acockburn commented Jul 9, 2017

Looking at this again - the standard ha log function was intended to keep logfiles standard and in particular log app names by default, I want to keep that. There is nothing stopping you from setting up your own logging and making it global to all of your apps if you want to do that.

@acockburn acockburn closed this Jul 9, 2017

@acockburn

This comment has been minimized.

Copy link
Collaborator

acockburn commented Dec 3, 2018

Revisiting this - 4.0 will have a lot of logging love in it, including the ability to set debug levels for individual apps from apps.yaml or from the new admin console, custom formats, custom date formats and more. I will be releasing an initial beta in a few weeks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.