Hi..

I have created an application which is using the org.apache.log4j.Logger class for logging various INFO/DEBUG?ERROR messages..
The application is working fine, including logging, when Run As Java Application in the Eclipse IDE..(log file is generated successfully and entries too are created)
Then I exported the project to a .jar file.
On running the jar file from the command prompt as :
C:\decNew>java -jar Decrypt.jar OutputFile.txt DecryptFile.txt
,the application is working fine but the log file is not generated...I am getting the following message on the command prompt :

log4j:WARN No appenders could be found for logger(com.decSrc.DecEntryClass).
log4j:WARN Please initialize the log4j system properly.

Manifest file contents:

Manifest-Version: 1.0
Main-Class: com.decSrc.DecEntryClass
Class-Path: log4j.jar

log4j.properties

log4j.rootCategory=DEBUG, R, O
# Stdout
log4j.appender.O=org.apache.log4j.ConsoleAppender
# File
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=C:\logs\log4j.log
# Control the maximum log file size
log4j.appender.R.MaxFileSize=100KB
# Archive log files (one backup file here)
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.O.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
log4j.appender.O.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n

Any suggestions?

Recommended Answers

All 4 Replies

i also have the similar problem...

solution please..........

I am not sure but probably the class you are using isnt defined in your classpath. You might have installed some file which would had only be installed for Eclipse. You might need include the jar file in jre\lib\ext to so that the class is recognized by your command promt

i already added jar in eclipse at configure build path ...

so i think it might something but not related to your point of view...

Have try to run log4j example

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.