Why do you feel the need to define -Dlog4j.configuration?  Auto-configuration should pick up log4j.properties on its own.  Have you tried that?  Otherwise, to point to the props inside the jar file, you need...

java -Dlog4j.configuration=jar:file:/full/path/to/myapp.jar!/log4j.properties -jar myapp.jar


Jake


On Wed, 7 May 2008 03:01:05 -0700 (PDT)
 AbelMacAdam <[EMAIL PROTECTED]> wrote:

I changed the entry in the batch file starting the application to:
java -Dlog4j.configuration=file:./log4j.properties -jar myapp.jar

(See the ./ between the file: and log4j.properties?)

I seem not to be able to start the application double clicking the jar
file AND using the log system at the same time.


AbelMacAdam wrote:

Hi,

The application I created uses log4j to log states to a log file. As the
application should run on either Windows or Unix, and either slow, or full
blast (debugging) I had to remove the properties file from the executable
jar file and to the directory that same executable jar file is stored. The
customer can now rename one of the different properties files to
log4j.properties to suite their wishes (either slow logging or full blast,
and dependent on their operating system).

So far the theory. Now getting it to work in practice...

I get the following error message when I start the application using
java -Dlog4j.properties=file:log4j.properties -jar myapp.jar
log4j:WARN No appenders could be found for logger (foo.bar.MyApplication).
log4j:WARN Please initialize the log4j system properly.

The directory structure used is:
<path>/MyApp
  |-myapp.jar
  |-log4j.properties
  |-log4j_unix_full_logging.properties
  |-log4j_unix_slow_logging.properties
  |-log4j_windows_full_logging.properties
  |-log4j_windows_slow_logging.properties
  |-Readme.txt

Or, stated in text, the executable myapp.jar and log4j.properties file
reside together in the same directory.

I even added a point to my classpath... (set CLASSPATH=.;CLASSPATH). Do
you know what I need to do to get the logging working?

Abel


--
View this message in context: http://www.nabble.com/log4j.properties-file-outside-jar-file--tp17100339p17101072.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to