[jira] [Comment Edited] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15746341#comment-15746341 ] Neon edited comment on LOG4J2-1302 at 12/13/16 9:41 PM: well, the current documentation is misleading. it should say that it is a log4j-api-slf4j-impl and it should probably have *note* to add log4j-core as runtime dependency. e.g. The Log4j 2 SLF4J Binding description should be updated at https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html From: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation. To: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 API as the implementation. and maybe under Usage section: put a note, that most user's will probably add *log4j-core* as a *runtime* dependency. was (Author: neon): well, the current documentation is misleading. it should say that it is a log4j-api-slf4j-impl and it should probably have not to add log4j-core as runtime dependency. e.g. The Log4j 2 SLF4J Binding description should be updated at https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html From: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation. To: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 API as the implementation. and maybe under Usage section: put a note, that most user's will probably add *log4j-core* as a *runtime* dependency. > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15746341#comment-15746341 ] Neon commented on LOG4J2-1302: -- well, the current documentation is misleading. it should say that it is a log4j-api-slf4j-impl and it should probably have not to add log4j-core as runtime dependency. e.g. The Log4j 2 SLF4J Binding description should be updated at https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html From: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation. To: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 API as the implementation. and maybe under Usage section: put a note, that most user's will probably add *log4j-core* as a *runtime* dependency. > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732909#comment-15732909 ] Neon commented on LOG4J2-1302: -- I think the Log4j 2 SLF4J Binding description should be updated at https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html From: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation. To: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 *API* as the implementation. and maybe under Usage section: put a note, that most user's will probably add log4j-core as a runtime dependency. > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Comment Edited] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732890#comment-15732890 ] Neon edited comment on LOG4J2-1302 at 12/8/16 5:53 PM: --- yes, but the idea is to have *ONE* dependency that will send Slf4j logs to Log4j 2 (core) - even if it goes from slf4j to log4j-api to log4j-core, hence my suggestion for log4j-core-slf4j-impl,. So I would like a module (artifact) like: slf4j-to-log4j-api-to-log4j-core or log4j-api-slf4j-impl-to-log4j-core was (Author: neon): yes, my idea to help ONE dependency that will send Slf4j logs to Log4j 2 (core) - even if it goes from slf4j to log4j-api to log4j-core, hence my suggestion for log4j-core-slf4j-impl,. So I would like a module (artifact) like: slf4j-to-log4j-api-to-log4j-core or log4j-api-slf4j-impl-to-log4j-core > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732890#comment-15732890 ] Neon commented on LOG4J2-1302: -- yes, my idea to help ONE dependency that will send Slf4j logs to Log4j 2 (core) - even if it goes from slf4j to log4j-api to log4j-core, hence my suggestion for log4j-core-slf4j-impl,. So I would like a module (artifact) like: slf4j-to-log4j-api-to-log4j-core or log4j-api-slf4j-impl-to-log4j-core > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732829#comment-15732829 ] Neon commented on LOG4J2-1302: -- So how about adding a log4j-core-slf4j-impl POM only module, that has dependency on both log4j-slf4j-impl and log4j-core? > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732810#comment-15732810 ] Neon commented on LOG4J2-1302: -- yes, that ERROR msg was very helpful :) > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Comment Edited] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732793#comment-15732793 ] Neon edited comment on LOG4J2-1302 at 12/8/16 5:16 PM: --- FYI, the description of the Log4j 2 SLF4J binding at https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html States: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation. >From that statement, I interpreted "Log4j 2 *implementation*" as log4j-core. So, it should be reword to "Log4j 2 API" and under Usage section of that page, there should be a note that you would still need to add log4j-core. Additionally, on that page it says: Use of the Log4j 2 SLF4J Binding (log4j-slf4j-impl-2.0.jar) together with the SLF4J adapter (log4j-to-slf4j-2.0.jar) should never be attempted, as it will cause events to endlessly be routed between SLF4J and Log4j 2. aka, ONE SHOULD NEVER use log4j-slf4j-impl and log4j-slf4j-impl (which counters your future proofing statement). was (Author: neon): FYI, the description of the Log4j 2 SLF4J binding at https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html States: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation. >From that statement, I interrupted Log4j 2 implementation as log4j-core. So, it should be reword to "Log4j 2 API" and under Usage section of that page, there should be a note that you would still need to add log4j-core. Additionally, on that page it says: Use of the Log4j 2 SLF4J Binding (log4j-slf4j-impl-2.0.jar) together with the SLF4J adapter (log4j-to-slf4j-2.0.jar) should never be attempted, as it will cause events to endlessly be routed between SLF4J and Log4j 2. aka, ONE SHOULD NEVER use log4j-slf4j-impl and log4j-slf4j-impl (which counters your future proofing statement). > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732793#comment-15732793 ] Neon commented on LOG4J2-1302: -- FYI, the description of the Log4j 2 SLF4J binding at https://logging.apache.org/log4j/2.0/log4j-slf4j-impl/index.html States: The Log4j 2 SLF4J Binding allows applications coded to the SLF4J API to use Log4j 2 as the implementation. >From that statement, I interrupted Log4j 2 implementation as log4j-core. So, it should be reword to "Log4j 2 API" and under Usage section of that page, there should be a note that you would still need to add log4j-core. Additionally, on that page it says: Use of the Log4j 2 SLF4J Binding (log4j-slf4j-impl-2.0.jar) together with the SLF4J adapter (log4j-to-slf4j-2.0.jar) should never be attempted, as it will cause events to endlessly be routed between SLF4J and Log4j 2. aka, ONE SHOULD NEVER use log4j-slf4j-impl and log4j-slf4j-impl (which counters your future proofing statement). > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Comment Edited] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732742#comment-15732742 ] Neon edited comment on LOG4J2-1302 at 12/8/16 5:07 PM: --- Generally, I don't think projects would route Slf4j logs to Log4j2 API then to Log4j 2 core impl. E.g. in my case I want to route Slf4j logs to Log4j 2 (impl - not API). But I can see your point for "future-proofing" so how about a log4j-core-slf4j-impl POM only module, that has dependency on log4j-core and log4j-slf4j-impl ? was (Author: neon): I can see your point for "future-proofing" so how about a log4j-core-slf4j-impl POM only module, that has dependency on log4j-core and log4j-slf4j-impl ? > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732742#comment-15732742 ] Neon commented on LOG4J2-1302: -- I can see your point for "future-proofing" so how about a log4j-core-slf4j-impl POM only module, that has dependency on log4j-core and log4j-slf4j-impl ? > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15732736#comment-15732736 ] Neon commented on LOG4J2-1302: -- if I don't have log4j-core, then I get the following ERROR: ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console... > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1302) log4j-slf4j-impl should provide a runtime dependency on log4j-core
[ https://issues.apache.org/jira/browse/LOG4J2-1302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15729754#comment-15729754 ] Neon commented on LOG4J2-1302: -- I really think log4j-slf4j-impl should have runtime dependency on log4j-core (yes, I can get around it by including both in my pom.xml but that is another entry that shouldn't be necessary. > log4j-slf4j-impl should provide a runtime dependency on log4j-core > -- > > Key: LOG4J2-1302 > URL: https://issues.apache.org/jira/browse/LOG4J2-1302 > Project: Log4j 2 > Issue Type: Improvement > Components: SLF4J Bridge >Reporter: Steve Davids > > After pulling in the log4j-slf4j-impl I was surprised to find out that I also > needed to add the the log4j-core dependency myself instead of the dependency > pulled in automatically from the log4j-slf4j-impl pom. I was expecting the > behavior provided by slf4j-log4j12 which does pull in the appropriate > implementation to get going immediately. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1487) Log4j RollingFileAppender every minute
[ https://issues.apache.org/jira/browse/LOG4J2-1487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15728826#comment-15728826 ] Neon commented on LOG4J2-1487: -- we are getting the same error with v2.7 on Linux > Log4j RollingFileAppender every minute > -- > > Key: LOG4J2-1487 > URL: https://issues.apache.org/jira/browse/LOG4J2-1487 > Project: Log4j 2 > Issue Type: Bug > Components: Appenders >Affects Versions: 2.6.2 > Environment: Windows 7 >Reporter: Enrique Lamas >Priority: Minor > > http://stackoverflow.com/questions/38638105/log4j-rollingfileappender-every-minute > I'm testing Log4j RollingFileAppender with log4j 2.6.2. > I want to rotate the logs every minute and so I have a log4j2.xml very > similar to one example of here > https://logging.apache.org/log4j/2.x/manual/appenders.html#RollingFileAppender. > This is my log4j2.xml > > > > C:/tmp/testlog4 > > > > filePattern="${baseDir}/$${date:-MM}/app-%d{-MM-dd-HH-mm}.log.gz"> > > > > > > > > > > > > > > > > > And this is an app where I write a log every second. > package testlog4j2; > import org.apache.logging.log4j.LogManager; > import org.apache.logging.log4j.Logger; > public class TestLog4j { > private final static Logger logger = > LogManager.getLogger(TestLog4j.class); > public static void main(String[] args) { > try { > for (int i=1; i<=240; i++) { > logger.info("Hello"); > Thread.sleep(1*1000); > } > } catch (Exception e) { > //e.printStackTrace(); > logger.error("Excepcion general", e); > } > } > } > What happens is: > once the system rotates the log at the first minute appears continuously > errors like this > 2016-07-28 15:10:02,015 Log4j2-Log4j2Scheduled-1 ERROR Unable to move file > C:\tmp\testlog4\2016-07\app-2016-07-28-15-10.log.gz to > C:\tmp\testlog4\2016-07\app-2016-07-28-15-10.log.gz: > java.nio.file.NoSuchFileException > C:\tmp\testlog4\2016-07\app-2016-07-28-15-10.log.gz -> > C:\tmp\testlog4\2016-07\app-2016-07-28-15-10.log.gz > There isn't a gz for every minute > The result gz don't have a log with 60 lines. Instead they have 1, 2 or three > lines of log. > The main log C:\tmp\testlog4\app.log has no content > Thanks -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1474) CronTriggeringPolicy raise exception and fail to rollover log file when evaluateOnStartup is true.
[ https://issues.apache.org/jira/browse/LOG4J2-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15728822#comment-15728822 ] Neon commented on LOG4J2-1474: -- Same NPE in v2.7, can this fix be back-ported to 2.7.1? > CronTriggeringPolicy raise exception and fail to rollover log file when > evaluateOnStartup is true. > -- > > Key: LOG4J2-1474 > URL: https://issues.apache.org/jira/browse/LOG4J2-1474 > Project: Log4j 2 > Issue Type: Bug > Components: Core >Affects Versions: 2.6.2 > Environment: mac osx capiton/jvm 1.7/log4j-core 2.6.2 >Reporter: yin mingjun >Assignee: Gary Gregory > Fix For: 2.8 > > > I am migrating my project from log1.x to log2.x, and I was using > DailyRollingFileAppender before, and now I am trying to use > RollingFileAppender instead it. > what i am doing is: > 1. write a config file, with RollingFile's config, and use > CronTriggeringPolicy config log file to roll over at middle-night. > 2. also set it's CronTriggeringPolicy's evaluateOnStartup=true, require check > roll over at start time. > 3. I touch my log file to an older time, check it is working alright. > my touch command is: > {{touch -t 1607220101 biz-pubsvc-service.log}} > then i start my project, then I got an InvocationTargetException > exception... > I then trace into the log4j2's source file, find the exception is caused > by CronTriggeringPolicy's initialize method: > {code} > public void initialize(RollingFileManager aManager) { > this.manager = aManager; > Date nextDate = new Date(this.manager.getFileTime()); > this.nextRollDate = > this.cronExpression.getNextValidTimeAfter(nextDate); > if(this.checkOnStartup && this.nextRollDate.getTime() < > System.currentTimeMillis()) { > this.rollover(); >>> here, call rollover, need this.future > } > this.future = > this.configuration.getScheduler().scheduleWithCron(this.cronExpression, new > CronTriggeringPolicy.CronTrigger()); >>> here assign this.future first time > } > {code} > we also refer CronTriggeringPolicy's rollover method's code: > {code} > private void rollover() { > > this.manager.getPatternProcessor().setPrevFileTime(this.nextRollDate.getTime()); > this.manager.rollover(); > Date fireDate = this.future.getFireTime(); >>> raise null pointer > exception here !!! > Calendar cal = Calendar.getInstance(); > cal.setTime(fireDate); > cal.add(13, -1); > this.nextRollDate = cal.getTime(); > } > {code} > I think this BUG is easy to fix up by moving [ this.future = ...] 's > assignment just before the call of [ this.rollover(); ]. > thanks. > Yin Mingjun > PS1: my log4j2.xml config file > --- > {code} > > > > filePattern="biz-pubsvc-service.log.%d{-MM-dd}" append="true"> > > > > > > > > > > > > > > > {code} > PS2: the raising exception's call stack > > {code} > 2016-07-25 18:30:25,910 main ERROR Unable to invoke factory method in class > class org.apache.logging.log4j.core.appender.RollingFileAppender for element > RollingFile. java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231) > at > org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496) > at > org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:566) > at >
[jira] [Commented] (LOG4J2-435) Feature request: auto-delete older log files
[ https://issues.apache.org/jira/browse/LOG4J2-435?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15709131#comment-15709131 ] Neon commented on LOG4J2-435: - I am same question, how do I specify Delete action in a log4j2.properties file? > Feature request: auto-delete older log files > - > > Key: LOG4J2-435 > URL: https://issues.apache.org/jira/browse/LOG4J2-435 > Project: Log4j 2 > Issue Type: Improvement >Reporter: Arkin Yetis >Assignee: Remko Popma > Labels: Rollover > Fix For: 2.5 > > Attachments: LimitingRolloverStrategy.java, SizeParser.java > > > Original description: > {quote} > DefaultRolloverStrategy max attribute only applies if you have a %i in the > file pattern. This request is to enhance DefaultRolloverStrategy or another > appropriate component to allow a max number of files limit to apply across > days/months/years when a filePattern includes a date pattern. > {quote} > > One of the most requested features is to add the ability to Log4j to "clean > up" older log files. This usually means deleting these files, although it > could also mean moving them to a different location, or some combination of > these. > Users have different requirements for selecting the files to clean up. A > common request is the ability to keep the last X number of log files. This > works well if rollover is only date based but may give undesired results with > size based rollover. > Another factor to consider is that the directory containing the log files may > contain the log files for multiple appenders, or even files unrelated to > logging. -- This message was sent by Atlassian JIRA (v6.3.4#6332) - To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-dev-h...@logging.apache.org
[jira] [Commented] (LOG4J2-1474) CronTriggeringPolicy raise exception and fail to rollover log file when checkOnStartup is true.
[ https://issues.apache.org/jira/browse/LOG4J2-1474?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15709103#comment-15709103 ] Neon commented on LOG4J2-1474: -- I also see this issue using v2.6.2 the cause of the InvocationTargetException is a NullPointerException at CronTriggeringPolicy.rollover(CronTriggeringPolicy.java:128) at CronTriggeringPolicy.initialize(CronTriggeringPolicy.java:69) at CompositeTriggeringPolicy.initialize(CompositeTriggeringPolicy.java:49) Looking at source code, looks like the the if (checkOnStartup) block is executed before the future variable has been initialized, hence the NPE. > CronTriggeringPolicy raise exception and fail to rollover log file when > checkOnStartup is true. > --- > > Key: LOG4J2-1474 > URL: https://issues.apache.org/jira/browse/LOG4J2-1474 > Project: Log4j 2 > Issue Type: Bug > Components: Core >Affects Versions: 2.6.2 > Environment: mac osx capiton/jvm 1.7/log4j-core 2.6.2 >Reporter: yin mingjun > Fix For: 2.8 > > > I am migrating my project from log1.x to log2.x, and I was using > DailyRollingFileAppender before, and now I am trying to use > RollingFileAppender instead it. > what i am doing is: > 1. write a config file, with RollingFile's config, and use > CronTriggeringPolicy config log file to roll over at middle-night. > 2. also set it's CronTriggeringPolicy's evaluateOnStartup=true, require check > roll over at start time. > 3. I touch my log file to an older time, check it is working alright. > my touch command is: > {{touch -t 1607220101 biz-pubsvc-service.log}} > then i start my project, then I got an InvocationTargetException > exception... > I then trace into the log4j2's source file, find the exception is caused > by CronTriggeringPolicy's initialize method: > {code} > public void initialize(RollingFileManager aManager) { > this.manager = aManager; > Date nextDate = new Date(this.manager.getFileTime()); > this.nextRollDate = > this.cronExpression.getNextValidTimeAfter(nextDate); > if(this.checkOnStartup && this.nextRollDate.getTime() < > System.currentTimeMillis()) { > this.rollover(); >>> here, call rollover, need this.future > } > this.future = > this.configuration.getScheduler().scheduleWithCron(this.cronExpression, new > CronTriggeringPolicy.CronTrigger()); >>> here assign this.future first time > } > {code} > we also refer CronTriggeringPolicy's rollover method's code: > {code} > private void rollover() { > > this.manager.getPatternProcessor().setPrevFileTime(this.nextRollDate.getTime()); > this.manager.rollover(); > Date fireDate = this.future.getFireTime(); >>> raise null pointer > exception here !!! > Calendar cal = Calendar.getInstance(); > cal.setTime(fireDate); > cal.add(13, -1); > this.nextRollDate = cal.getTime(); > } > {code} > I think this BUG is easy to fix up by moving [ this.future = ...] 's > assignment just before the call of [ this.rollover(); ]. > thanks. > Yin Mingjun > PS1: my log4j2.xml config file > --- > {code} > > > > filePattern="biz-pubsvc-service.log.%d{-MM-dd}" append="true"> > > > > > > > > > > > > > > > {code} > PS2: the raising exception's call stack > > {code} > 2016-07-25 18:30:25,910 main ERROR Unable to invoke factory method in class > class org.apache.logging.log4j.core.appender.RollingFileAppender for element > RollingFile. java.lang.reflect.InvocationTargetException > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:132) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479) > at > org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219) > at >