Question

I am having a seperate jar file which do some stuffs. Which is actually deployed in tomcat. Inside that jar I have a java file with main method. Say the class name is StartPoint. I am calling that main method from a shell script by "java StartPoint checkStatus". The main method validates the checkStatus param and do the job accordingly. All java files inside the jar uses log4j and uses log.info/log.debug for logging. These logs are working fine if tomcat is up. Due to some requirement I triggered the main method from a shell script and now I am unable to get those log information. Please help how can I get the logs added using logger.info/debug?

Was it helpful?

Solution

Try passing additional parameter with log4j config file path:

-Dlog4j.configuration={path to file}

how-do-i-set-log4j-level-on-the-command-line

log4j-configuration-via-jvm-arguments

OTHER TIPS

So I believe you just need to make sure that log4j.properties/log4j.xml is on the classpath when you call the StartPoint main method directly.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top