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

How to control console log level/format? #712

Closed
themalkolm opened this issue Nov 5, 2015 · 12 comments
Closed

How to control console log level/format? #712

themalkolm opened this issue Nov 5, 2015 · 12 comments

Comments

@themalkolm
Copy link

Hey, is it possible to disable curses UI completely and simply output logs on stdout?

@nicolargo
Copy link
Owner

With Glances 2.5 or higher, you can use the --quiet option to disable the curse interface.

@themalkolm
Copy link
Author

OK, I got the quiet option. But how to do this combo:

1. Disable curse interface
2. Redirect log to console and control it's level (DEBUG/INFO/...)

@themalkolm
Copy link
Author

Hm, I see that default log level for console is CRITICAL and no way to change it. Is it possible to provide custom logging.conf somehow?

@themalkolm
Copy link
Author

Just to give the context. I'm evaluating glances if it could be used on Windows as collectd-like daemon to send metrics to statsd server. So, I can disable curses UI - check. Now the question how to control console logs format/level/etc.

@themalkolm
Copy link
Author

And to save some time, is there any support for adding plugins via cfg somehow? I understand that I can add them to plugins folder and rebuild the project. But it would be nice to somehow use the version from pip and simply configure to have extra plugins.

@nicolargo
Copy link
Owner

Why don't you use directly the statsD plugin to populate your StatsD database ?
=> https://github.com/nicolargo/glances/blob/master/docs/glances-doc.rst#statsd

@themalkolm
Copy link
Author

  1. --export-statsd works fine, no problems here. Exports as expected.
  2. I want to have glance logs being printed to stdout (surely with disabled curses UI) and somehow control their format.
  3. I would like to implement custom plugins and this way extend exported metrics whenever required.

@themalkolm themalkolm changed the title Is it possible to switch to agent mode with logs to the console? How to control console log level/format? Nov 5, 2015
@nicolargo
Copy link
Owner

  1. You can have a look in the https://github.com/nicolargo/glances/blob/develop/glances/core/glances_logging.py file in order to change the log/format.
  2. All the plugins are exported. So if you add a new plugin to the https://github.com/nicolargo/glances/tree/develop/glances/plugins folder it should work. Best way to processed to write a new plugin is to start from an existing one and adapt to your needs. The plugin file should be named glances_xxx.py (where xxx is your plugin name).

Perhaps you can describe what kind of new metrics do you need ?

@nicolargo
Copy link
Owner

nicolargo commented May 5, 2016

@themalkolm any head up ?

I plan to make the Glances logging system configurable through the configuration file. Is it responding to yours needs ?

@themalkolm
Copy link
Author

@nicolargo yes, this will solve logging issue. I would say an essential part of any headless daemon.

@nicolargo nicolargo added this to the Next releases milestone May 7, 2016
@nicolargo nicolargo modified the milestones: Next releases, Version 2.8 Sep 11, 2016
@nicolargo
Copy link
Owner

Implementation done through the issue #900 .

Read the doc https://github.com/nicolargo/glances/blob/develop/docs/config.rst#logging to configure your own logger.

@themalkolm
Copy link
Author

Thanks!

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

No branches or pull requests

2 participants