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

Use Log::Log4perl with log levels #21

Open
prat0088 opened this issue Jun 22, 2016 · 5 comments
Open

Use Log::Log4perl with log levels #21

prat0088 opened this issue Jun 22, 2016 · 5 comments

Comments

@prat0088
Copy link
Contributor

The output from "serge sync" is pretty verbose right now. The important parts get lost in the debugging information. Reformatting would help, but Log::Log4perl with log levels would be best. It would allow me to reuse other logging infrastructure at my company.

Obviously not high on the list of priorities, but nice to have. I could submit a pull request for this in the future if/after we roll Serge out.

@prat0088
Copy link
Contributor Author

@iafan Would you consider merging a PR that replaces all prints with Log::Log4perl statements, provided the output of Serge remains exactly the same?

@iafan
Copy link
Contributor

iafan commented Dec 29, 2016

Log::Log4perl-based logging can be handy. Can you share some snippet (or one file converted this way) before the entire PR lands so that we could agree on details?

Specific questions/suggestions I have in mind:

  1. Use standard mode, not the easy one. I want to see calls like $logger->debug('...');, $logger->warn('etc');
  2. Define logging based on current package name. Something like my $log = Log::Log4perl->get_logger(__PACKAGE__);
  3. Let's agree on how the old --debug CLI parameter would work. Can Log4perl just use this as an override default logging level? Can this probably be a shortcut to --loglevel=debug with the possibility to specify any override level?

@prat0088
Copy link
Contributor Author

prat0088 commented Dec 29, 2016

All three of your points sound great. I was thinking along the same lines.

I'm not sure when I'll be able to start but it's an enhancement I'm keen to make.

Sure, I'll push a something to a branch after after I finish the a classes and the parameters on the main serge script.

@iafan
Copy link
Contributor

iafan commented Dec 29, 2016

Also: Ideally, Serge should use some reasonable defaults without having a special log config file and without having users to create/alter one. By default, it would use some 'normal' output level which will currently be the same as the current output. Providing --debug or --loglevel=... would change the level globally; only when someone wants to debug a particular module, they would need to put a file called e.g. log4perl.conf next to Serge binary in order to tweak the logging settings. Such config would be listed in .gitignore. Does that sound reasonable?

@iafan
Copy link
Contributor

iafan commented Dec 29, 2016

And there's one failing test that needs to be fixed upstream before we can integrate Log4perl (though it seems to be a minor one). See mschilli/log4perl#77

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