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 cbowditch <bo...@hotmail.com> on 2009/09/07 12:12:46 UTC

0-byte log file created when using IBM JDK

Hi All,

I have an application that uses log4j debugging and the log files are
created perfectly when using Sun JDK 5. However, my customer has IBM JDK 5
and when I enable log4J debugging the log file is created but is 0 bytes.
The exact same log4J configuration file is used on Sun and IBM JDKs

My Java application uses PropertyConfigurator.configure to configure log4J,
but log4J finds a log4j.properties file somewhere in the classpath. I
spotted this by turning on log4J debugging using -Dlog4j.debug=true.
However, specifying the path using -Dlog4J.configuration doesn't help and
log4J is still initialized twice due to the call to
PropertyConfigurator.configure. The output from log4 debug is shown below. I
suspect that IBM JDK intercepts log4J messages as you can configure logging
from within Websphere. Although my application runs standalone and is not a
web application. Does anyone know why the messages don't make it to the log
file?

log4j: Using URL
[file:/C:/Thunderhead40/servers/thserverWAS/config/JLBProtocolD
ebug.cfg] for automatic log4j configuration.
log4j: Reading configuration from URL
file:/C:/Thunderhead40/servers/thserverWAS
/config/JLBProtocolDebug.cfg
log4j: Parsing for [root] with value=[warn,file].
log4j: Level token is [warn].
log4j: Category root set to WARN
log4j: Parsing appender named "file".
log4j: Parsing layout options for "file".
log4j: Setting property [conversionPattern] to [%r [%p] %C{1}.%M(): - %m%n].
log4j: End of parsing for "file".
log4j: Setting property [file] to
[c:\thunderhead40\servers\thserverWAS\bin\JLBP
rotocolDebug.log].
log4j: Setting property [maxBackupIndex] to [1].
log4j: Setting property [threshold] to [DEBUG].
log4j: Setting property [maxFileSize] to [1000KB].
log4j: setFile called:
c:\thunderhead40\servers\thserverWAS\bin\JLBProtocolDebug
.log, true
log4j: setFile ended
log4j: Parsed "file" options.
log4j: Parsing for [org.jgroups] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category org.jgroups set to DEBUG
log4j: Handling log4j.additivity.org.jgroups=[null]
log4j: Finished configuring.
log4j: Parsing for [root] with value=[warn,file].
log4j: Level token is [warn].
log4j: Category root set to WARN
log4j: Parsing appender named "file".
log4j: Parsing layout options for "file".
log4j: Setting property [conversionPattern] to [%r [%p] %C{1}.%M(): - %m%n].
log4j: End of parsing for "file".
log4j: Setting property [file] to
[c:\thunderhead40\servers\thserverWAS\bin\JLBP
rotocolDebug.log].
log4j: Setting property [maxBackupIndex] to [1].
log4j: Setting property [threshold] to [DEBUG].
log4j: Setting property [maxFileSize] to [1000KB].
log4j: setFile called:
c:\thunderhead40\servers\thserverWAS\bin\JLBProtocolDebug
.log, true
log4j: setFile ended
log4j: Parsed "file" options.
log4j: Parsing for [org.jgroups] with value=[DEBUG].
log4j: Level token is [DEBUG].
log4j: Category org.jgroups set to DEBUG
log4j: Handling log4j.additivity.org.jgroups=[null]
log4j: Finished configuring.
-- 
View this message in context: http://www.nabble.com/0-byte-log-file-created-when-using-IBM-JDK-tp25328152p25328152.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Re: 0-byte log file created when using IBM JDK

Posted by cbowditch <bo...@hotmail.com>.
Since writing this mail I have realised that my application uses log4j via
Apache Commons Logging. So that the problem is likely a class loading issue
as described here: http://www.qos.ch/logging/classloader.jsp. I have tried
putting log4j and commons-logging jars both into lib\endorsed directory of
the IBM JDK and that results in a NPE when trying to initialize the commons
logging LogFactory. I guess I still have much to understand about how
commons logging interacts with log4j in an IBM JDK. I would appreciate if
anyone can help point me in the right direction. 

I also forgot to say that I'm using log4j v1.2.8 and commons logging v1.0.4.

Thanks,

Chris


cbowditch wrote:
> 
> Hi All,
> 
> I have an application that uses log4j debugging and the log files are
> created perfectly when using Sun JDK 5. However, my customer has IBM JDK 5
> and when I enable log4J debugging the log file is created but is 0 bytes.
> The exact same log4J configuration file is used on Sun and IBM JDKs
> 
> My Java application uses PropertyConfigurator.configure to configure
> log4J, but log4J finds a log4j.properties file somewhere in the classpath.
> I spotted this by turning on log4J debugging using -Dlog4j.debug=true.
> However, specifying the path using -Dlog4J.configuration doesn't help and
> log4J is still initialized twice due to the call to
> PropertyConfigurator.configure. The output from log4 debug is shown below.
> I suspect that IBM JDK intercepts log4J messages as you can configure
> logging from within Websphere. Although my application runs standalone and
> is not a web application. Does anyone know why the messages don't make it
> to the log file?
> 
> log4j: Using URL
> [file:/C:/Thunderhead40/servers/thserverWAS/config/JLBProtocolD
> ebug.cfg] for automatic log4j configuration.
> log4j: Reading configuration from URL
> file:/C:/Thunderhead40/servers/thserverWAS
> /config/JLBProtocolDebug.cfg
> log4j: Parsing for [root] with value=[warn,file].
> log4j: Level token is [warn].
> log4j: Category root set to WARN
> log4j: Parsing appender named "file".
> log4j: Parsing layout options for "file".
> log4j: Setting property [conversionPattern] to [%r [%p] %C{1}.%M(): -
> %m%n].
> log4j: End of parsing for "file".
> log4j: Setting property [file] to
> [c:\thunderhead40\servers\thserverWAS\bin\JLBP
> rotocolDebug.log].
> log4j: Setting property [maxBackupIndex] to [1].
> log4j: Setting property [threshold] to [DEBUG].
> log4j: Setting property [maxFileSize] to [1000KB].
> log4j: setFile called:
> c:\thunderhead40\servers\thserverWAS\bin\JLBProtocolDebug
> .log, true
> log4j: setFile ended
> log4j: Parsed "file" options.
> log4j: Parsing for [org.jgroups] with value=[DEBUG].
> log4j: Level token is [DEBUG].
> log4j: Category org.jgroups set to DEBUG
> log4j: Handling log4j.additivity.org.jgroups=[null]
> log4j: Finished configuring.
> log4j: Parsing for [root] with value=[warn,file].
> log4j: Level token is [warn].
> log4j: Category root set to WARN
> log4j: Parsing appender named "file".
> log4j: Parsing layout options for "file".
> log4j: Setting property [conversionPattern] to [%r [%p] %C{1}.%M(): -
> %m%n].
> log4j: End of parsing for "file".
> log4j: Setting property [file] to
> [c:\thunderhead40\servers\thserverWAS\bin\JLBP
> rotocolDebug.log].
> log4j: Setting property [maxBackupIndex] to [1].
> log4j: Setting property [threshold] to [DEBUG].
> log4j: Setting property [maxFileSize] to [1000KB].
> log4j: setFile called:
> c:\thunderhead40\servers\thserverWAS\bin\JLBProtocolDebug
> .log, true
> log4j: setFile ended
> log4j: Parsed "file" options.
> log4j: Parsing for [org.jgroups] with value=[DEBUG].
> log4j: Level token is [DEBUG].
> log4j: Category org.jgroups set to DEBUG
> log4j: Handling log4j.additivity.org.jgroups=[null]
> log4j: Finished configuring.
> 

-- 
View this message in context: http://www.nabble.com/0-byte-log-file-created-when-using-IBM-JDK-tp25328152p25333066.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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