You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Ralph Goers (Jira)" <ji...@apache.org> on 2022/05/15 22:08:00 UTC
[jira] [Resolved] (LOG4J2-3433) Multiple log files need to be generated based on package
[ https://issues.apache.org/jira/browse/LOG4J2-3433?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Ralph Goers resolved LOG4J2-3433.
---------------------------------
Resolution: Information Provided
Marking as resolved. If you agree, please close this. If you don't agree please reopen and provide more information.
> Multiple log files need to be generated based on package
> --------------------------------------------------------
>
> Key: LOG4J2-3433
> URL: https://issues.apache.org/jira/browse/LOG4J2-3433
> Project: Log4j 2
> Issue Type: Request
> Components: Appenders, Configuration
> Affects Versions: 2.17.2
> Environment: linux OS
> Reporter: Thangadurai Kandhasamy
> Priority: Blocker
> Labels: documentation, features
> Attachments: log4j2.properties
>
>
> Team,
> We are using Apache log4j 1.2.x we are able to generate Multiple log files based on package.
> As we planned to upgrade from 1.2.x to 2.17.0 we are not able to generate Multiple log files based on package.
> Assume our packages are
> 1.com.application.test.pack1
> 2.com.application.test.pack2
> As per below configuration {+}we could get all the logs into *single log file*{+}.
> logger.app.name = com.application.test
> We +expect to log all the logs related+ to *com.application.test.pack1* should be *{color:#ff8b00}pack1.log{color};* same way *com.application.test.pack2* should be *{color:#ff8b00}pack2.log{color},* We tried multiple options and also referred official documentation site [https://logging.apache.org/log4j/2.x/manual/appenders.html]. However we don't find any reference based on our need.
> Below is the log4j2.properties. Same you can find in the attachment section.
> _______________________________________________________
> status = warn
> appender.console.type = Console
> appender.console.name = LogToConsole
> appender.console.layout.type = PatternLayout
> appender.console.layout.pattern = %d\{yyyy-MM-dd HH:mm:ss.SSS} (%t) %-5level [%logger\{36}.%M:%L] - %msg%n
> # Rotate log file
> appender.rolling.type = RollingFile
> appender.rolling.name = LogToRollingFile
> appender.rolling.fileName = logs/{*}{color:#ff8b00}app.log{color}{*}
> appender.rolling.filePattern = logs/$${date:yyyy-MM}/app-%d\{MM-dd-yyyy}-%i.log.gz
> appender.rolling.layout.type = PatternLayout
> appender.rolling.layout.pattern = %d\{yyyy-MM-dd HH:mm:ss.SSS} (%t) %-5level [%logger\{36}.%M:%L] - %msg%n
> appender.rolling.policies.type = Policies
> appender.rolling.policies.time.type = TimeBasedTriggeringPolicy
> appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
> appender.rolling.policies.size.size=10MB
> appender.rolling.strategy.type = DefaultRolloverStrategy
> appender.rolling.strategy.max = 10
> # Log to console and rolling file
> logger.app.name = *com.application.test*
> logger.app.level = debug
> logger.app.additivity = false
> logger.app.appenderRef.rolling.ref = LogToRollingFile
> logger.app.appenderRef.console.ref = LogToConsole
> rootLogger.level = info
> rootLogger.appenderRef.stdout.ref = LogToConsole
> _______________________________________________________
>
> Please advise.
>
> Regards
> Thanga
--
This message was sent by Atlassian Jira
(v8.20.7#820007)