Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with log4j external configuration

 
venkatesh loganathan
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
Iam not able to log messages to a file when i try to access log information froma file.I have a log4jconfig -- Logconfig.xml file like below
---------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="cmeAppender"
class="org.apache.log4j.FileAppender">
<param name="File" value="Indentify-Log.txt"/>
<param name="Append" value="false"/>

<layout class="org.apache.log4j.PatternLayout"/>
</appender>

<root>
<priority value="debug" />
<appender-ref ref="cmeAppender"/>
</root>

</log4j:configuration>
---------------------------------------------------------------------------

And my program which reads this file for logging goes like this



final Logger logger = Logger.getLogger(EditShopperAction.class);
PropertyConfigurator.configure("LogConfig.xml");
logger.debug("Here is some DEBUG");
logger.info("Here is some INFO");
logger.warn("Here is some WARN");
logger.error("Here is some ERROR");
logger.fatal("Here is some FATAL");

---------------------------------------------------------------------------

Both my xml and jav pgm are in the same path .Even then iam not able to record the log messages int oa file.

When not specified in external configuration its working fine (i.e programatically logging) .What could be the resaon for this.Can anybody help me out regarding this .Do i need to make any other entry in struts-config.xml etc...

Iam using xdoclet and ant for JBoss 3.2.4 server.


Thanks in advance

Venkatesh Loganathan
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems like your app server cannot find the configuration file in it to log something... I would suggest to consult with the documents available for JBoss Struts related stuff...

If you can log it programmatically, it won't be a big deal... You will find your answer in the manuals and documents of your application server...

Just my 2 cents...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic