You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Shawn Heisey <ap...@elyograg.org> on 2014/11/02 18:13:39 UTC

RollingFileAppender appears to be losing log entries

I asked this question on the solr-user mailing list first, but got no response.  It's a major party weekend, so I'm not really surprised, and I think this is probably a problem with log4j, not Solr.

There appear to be large blocks of time missing in my solr logfiles created with slf4j->log4j and rotated using the log4j config:

End of solr.log.1: INFO  - 2014-10-31 12:52:25.073;
Start of solr.log: INFO  - 2014-11-01 02:27:27.404;

End of solr.log.2: INFO  - 2014-10-29 06:30:32.661;
Start of solr.log.1: INFO  - 2014-10-30 07:01:34.241;

There is about 2.5 hours missing for the first pair, and over 24 hours missing for the second.  I have not checked all the logfiles to see if they are missing time.

Queries happen at a fairly constant low level at almost all hours, and updates happen once a minute, so I know for sure that there is activity during the missing blocks of time.  I had a weird problem during the time that is missing, so I have no way to determine what happened.

This is the log4j configuration that I'm using:

http://apaste.info/9vC

These are the logging jars that I have in jetty's lib/ext:

-rw-r--r-- 1 ncindex ncindex  16515 Apr 11  2014 jcl-over-slf4j-1.7.6.jar
-rw-r--r-- 1 ncindex ncindex   4959 Apr 11  2014 jul-to-slf4j-1.7.6.jar
-rw-r--r-- 1 ncindex ncindex 489883 Apr 11  2014 log4j-1.2.17.jar
-rw-r--r-- 1 ncindex ncindex  28688 Apr 11  2014 slf4j-api-1.7.6.jar
-rw-r--r-- 1 ncindex ncindex   8869 Apr 11  2014 slf4j-log4j12-1.7.6.jar

I did find this blog post describing a similar problem with a different Appender:

http://vivekagarwal.wordpress.com/2008/02/09/missing-log4j-log-files-with-dailyrollingfileappender-when-they-should-roll-over/

I'm not running on Windows, I'm on CentOS 6.  Linux normally does not have problems with renaming files even when they are open, and I am not running anything else on the system that could open logfiles with an exclusive lock.

My logfiles where I redirect stdout and stderr from Jetty don't show anything related, and I don't see anything like the error mentioned on that blog post in any of the surviving logfiles from log4j.

Is this a bug, or have I done something wrong in my config?  My best guess about how this is happening is that an entire logfile is getting deleted during rotation.  Is there anything I can do to shed some light on what's happening, at least to pinpoint which software package is behaving badly?

Thanks,
Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: RollingFileAppender appears to be losing log entries

Posted by Ralph Goers <ra...@dslextreme.com>.
We have attempted to list the dependencies at http://logging.apache.org/log4j/2.x/runtime-dependencies.html <http://logging.apache.org/log4j/2.x/runtime-dependencies.html> and http://logging.apache.org/log4j/2.x/faq.html#which_jars <http://logging.apache.org/log4j/2.x/faq.html#which_jars>.

You need log4j-api and log4j-core for Log4j itself. If you are running in a web app then you would also need log4j-web.

For bridging Log4j 1.x to Log4j 2 you need the log4j-1.2-api jar.

For bridging commons logging to log4j 2 you need the commons logging jar + the log4j-jcl jar.

For binding SLF4J to Log4j 2 you need the SLF4J API and the log4j-slf4j-impl jar.

For java.util.logging you need the log4j-jul jar (and you will have to set a system property).

You are currently routing all the logging to SLF4J. If you want you can continue to do that and simply remove log4j-1.2.17.jar and slf4j-log4j12-1.7.6.jar and replace them with the log4j-slf4j-impl, log4j-api and log4j-core jars (+ log4j-web in a servlet container).

Ralph



> On Nov 2, 2014, at 5:02 PM, Shawn Heisey <ap...@elyograg.org> wrote:
> 
> On 11/2/2014 12:57 PM, Ralph Goers wrote:
>> 1.  I would check bugzilla to see if anyone has reported this. I don’t recall seeing anything like it in the last 4 years.
>> 2. Log4j 1.x is not actively maintained. Even if you find that it is a bug it is unlikely to ever be fixed. Upgrading to Log4j 2 is recommended.
> 
> When I looked at the slf4j site, I could not see a binding for log4j2.
> Digging deeper, it does appear that log4j2 itself might provide the
> necessary functionality, but I am having some trouble figuring out
> exactly which jars I need in order to handle everything.
> 
> Solr uses slf4j for logging, and some of solr's dependencies require jcl
> as well as java.util.logging, so those must be properly intercepted.
> Solr itself has a few dependencies on log4j 1.x, mostly in the handling
> of a Logging tab for the admin UI (one implementation watches log4j, the
> other watches java.util.logging), but it seems that some util classes
> also have a dependency.
> 
> As I said in the original email, here's the jars I'm using now:
> 
> jcl-over-slf4j-1.7.6.jar
> jul-to-slf4j-1.7.6.jar
> log4j-1.2.17.jar
> 2014 slf4j-api-1.7.6.jar
> slf4j-log4j12-1.7.6.jar
> 
> Can you help me figure out a new set of jars to use version 2.1?  I
> guess I'll figure out at that point whether any source code changes are
> required.  It does appear that I will need a new configuration file,
> because I don't see any non-xml config examples.
> 
> Thanks,
> Shawn
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


Re: RollingFileAppender appears to be losing log entries

Posted by Shawn Heisey <ap...@elyograg.org>.
On 11/2/2014 12:57 PM, Ralph Goers wrote:
> 1.  I would check bugzilla to see if anyone has reported this. I don’t recall seeing anything like it in the last 4 years.
> 2. Log4j 1.x is not actively maintained. Even if you find that it is a bug it is unlikely to ever be fixed. Upgrading to Log4j 2 is recommended.

When I looked at the slf4j site, I could not see a binding for log4j2.
Digging deeper, it does appear that log4j2 itself might provide the
necessary functionality, but I am having some trouble figuring out
exactly which jars I need in order to handle everything.

Solr uses slf4j for logging, and some of solr's dependencies require jcl
as well as java.util.logging, so those must be properly intercepted.
Solr itself has a few dependencies on log4j 1.x, mostly in the handling
of a Logging tab for the admin UI (one implementation watches log4j, the
other watches java.util.logging), but it seems that some util classes
also have a dependency.

As I said in the original email, here's the jars I'm using now:

jcl-over-slf4j-1.7.6.jar
jul-to-slf4j-1.7.6.jar
log4j-1.2.17.jar
2014 slf4j-api-1.7.6.jar
slf4j-log4j12-1.7.6.jar

Can you help me figure out a new set of jars to use version 2.1?  I
guess I'll figure out at that point whether any source code changes are
required.  It does appear that I will need a new configuration file,
because I don't see any non-xml config examples.

Thanks,
Shawn


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: RollingFileAppender appears to be losing log entries

Posted by Ralph Goers <ra...@dslextreme.com>.
1.  I would check bugzilla to see if anyone has reported this. I don’t recall seeing anything like it in the last 4 years.
2. Log4j 1.x is not actively maintained. Even if you find that it is a bug it is unlikely to ever be fixed. Upgrading to Log4j 2 is recommended.

Ralph

> On Nov 2, 2014, at 10:13 AM, Shawn Heisey <ap...@elyograg.org> wrote:
> 
> I asked this question on the solr-user mailing list first, but got no response.  It's a major party weekend, so I'm not really surprised, and I think this is probably a problem with log4j, not Solr.
> 
> There appear to be large blocks of time missing in my solr logfiles created with slf4j->log4j and rotated using the log4j config:
> 
> End of solr.log.1: INFO  - 2014-10-31 12:52:25.073;
> Start of solr.log: INFO  - 2014-11-01 02:27:27.404;
> 
> End of solr.log.2: INFO  - 2014-10-29 06:30:32.661;
> Start of solr.log.1: INFO  - 2014-10-30 07:01:34.241;
> 
> There is about 2.5 hours missing for the first pair, and over 24 hours missing for the second.  I have not checked all the logfiles to see if they are missing time.
> 
> Queries happen at a fairly constant low level at almost all hours, and updates happen once a minute, so I know for sure that there is activity during the missing blocks of time.  I had a weird problem during the time that is missing, so I have no way to determine what happened.
> 
> This is the log4j configuration that I'm using:
> 
> http://apaste.info/9vC
> 
> These are the logging jars that I have in jetty's lib/ext:
> 
> -rw-r--r-- 1 ncindex ncindex  16515 Apr 11  2014 jcl-over-slf4j-1.7.6.jar
> -rw-r--r-- 1 ncindex ncindex   4959 Apr 11  2014 jul-to-slf4j-1.7.6.jar
> -rw-r--r-- 1 ncindex ncindex 489883 Apr 11  2014 log4j-1.2.17.jar
> -rw-r--r-- 1 ncindex ncindex  28688 Apr 11  2014 slf4j-api-1.7.6.jar
> -rw-r--r-- 1 ncindex ncindex   8869 Apr 11  2014 slf4j-log4j12-1.7.6.jar
> 
> I did find this blog post describing a similar problem with a different Appender:
> 
> http://vivekagarwal.wordpress.com/2008/02/09/missing-log4j-log-files-with-dailyrollingfileappender-when-they-should-roll-over/
> 
> I'm not running on Windows, I'm on CentOS 6.  Linux normally does not have problems with renaming files even when they are open, and I am not running anything else on the system that could open logfiles with an exclusive lock.
> 
> My logfiles where I redirect stdout and stderr from Jetty don't show anything related, and I don't see anything like the error mentioned on that blog post in any of the surviving logfiles from log4j.
> 
> Is this a bug, or have I done something wrong in my config?  My best guess about how this is happening is that an entire logfile is getting deleted during rotation.  Is there anything I can do to shed some light on what's happening, at least to pinpoint which software package is behaving badly?
> 
> Thanks,
> Shawn
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org