This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

log file not getting created using log4j

 
Ranch Hand
Posts: 1255
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
log file not getting created or written to using log4j

I have a core java application deployed in unix.I have created a jar of the application MyApp.jar.I am calling this jar from a script Myscript.ksh I am trying to add logging for the application but on running it the log file does not get created.

I have followed the below steps:


1) In the same folder as the main class of the jar I have put log4j.properties.In this file I have specified the file to be created during logging.
2) I use a build.xml file to create the MyApp.jar. In this build.xml I have put lines to have the jars for log4j in the classpath along with java.

3) In the script Myscript.ksh also I have put lines to have the jars for log4j in the classpath along with java.

When I call MyApp.jar using Myscript.jar it does not create the log file.Have I missed any step.Please advice.thanks


 
Monica Shiralkar
Ranch Hand
Posts: 1255
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does log4j related jars need to be only on Classpath or PATH also?There are no error messages which may be helpful to debug.On running it nothing happens for the log and no error message related to log.
 
Sheriff
Posts: 24654
58
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the jars only need to be in the classpath. And your properties file needs to be there too. I'm not convinced that it is based on your description.
 
She still doesn't approve of my superhero lifestyle. Or this shameless plug:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!