views:

165

answers:

3

I run a java program from a jar file in Linux Redhat 4.3 and use eclipse for creating the jar file from my project.

If I create the jar file when running eclipse in linux everything is ok (normal logfile name and normal text format in the logfile).

However, if I create the jar when running eclispe under WinXP (and send it to my linux server via ftp) the logfile name is java0.log.0 and the text inside is in XML.

one more thing - my program uses SimpleFormatter as the formatter for the log file.

any ideas?

A: 

java.util.logging.FileHandler will log by default as XML. So I wonder if you're not specifying the path to your logging configuration properly. Thus it'll work on Linux, but not on Windows.

Brian Agnew
A: 

How are you creating the Jar file "in eclipse"? Are you using Eclipse's Export -> Java -> JAR File? Or are you running an ANT or Maven script through Eclipse?

If you're just exporting from Eclipse directly - I'd recommend using ANT or Maven to get a repeatable build process not tied to the IDE.

If you're building from ANT or Maven, I'd check for local configuration overriding something to do with logging in the build script.

It may also be that there's a platform specific path embedded in the application or build script and your log4j properties file isn't being found, so log4j is just going with defaults. Though, I'm not sure if XML formatting and the log file name format you specified is the default.

Nate
Eclipse gives an option to create an Ant build.xml that you can use after the initial jar creation.
Owen
A: 

Your machine could be using different JAVA compiler versions - perhaps between versions there is different default behavior.

JamesG