0

I am running a shell script to execute a java program. when invoking the java program i am passing

-Dlog4j.configuration=${SRD_BATCH_HOME}/propertyfile/log4j.properties

When i run the program i see this on top of the log

log4j: Trying to find [/some path/log4j.properties] using context classloader

sun.misc.Launcher$AppClassLoader@4aad3ba4. log4j: Trying to find [/some path/log4j.properties] using sun.misc.Launcher$AppClassLoader@4aad3ba4 class loader. log4j: Trying to find [/some path/log4j.properties] using ClassLoader.getSystemResource(). log4j: Could not find resource: [/some path/log4j.properties].

But my log4j is lying right at this place //log4j.properties

I added BasicConfigurator.configure() in my java program and the logs started printing but now its printing everything as its not looking at my properties file. can someone help out on what could be wrong here.

Shikha
  • 39
  • 2
  • 10

1 Answers1

1

Try adding "file:/" to the start of the file path

-Dlog4j.configuration=file:/${SRD_BATCH_HOME}/propertyfile/log4j.properties

as specified here

Community
  • 1
  • 1
CodeClimber
  • 4,584
  • 8
  • 46
  • 55