question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

multiple log files with different log levels

See original GitHub issue

Is it possible for a log message to appear in multiple log files with depending on their configurations?

For example I’d like all log messages to go to my main log file myapp.log and only the error messages to go to error.log?

Can I specify multiple file transports, like this?

log.transports.file1
log.transports.file2

or

log.transports.file.1
log.transports.file.2

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gozzoocommented, Nov 20, 2019

OK, great. Thanks for creating, maintaining and improving this project.

1reaction
megahertzcommented, Mar 23, 2019

There is no straightforward way. You can write a custom hook which changes log.transports.file.file depending on a message level.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Different level of logs in different log files - Stack Overflow
Finally got the answer by doing this i got the logs in different files. <Loggers> <logger name="com.mvc.login" level="info" ...
Read more >
How to write logs into separate files based on log levels
Logs can be written into separate files based on the log level. Example: ERROR logs into error.log, WARN logs into warn.log etc.
Read more >
SLF4J: Different Log Files for Different Log Levels - MBcoder
Configuring the SLF4J(Simple Logging Facade for Java) and LOGBack to create different log files for different log levels.
Read more >
Log4j – Custom Log Levels - Apache Logging Services
Custom log levels can be defined in code or in configuration. To define a custom log level in code, use the Level.forName() method....
Read more >
Configure log4net to log to two different log files
Configure log4net to log to two different log files · Method 1: Using two named loggers · Method 2: Using root logger and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found