Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Log4J Configuring Log4J
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Ankur Dabas
Configuring Log4J
1 Answer(s)      3 years and 11 months ago
Posted in : Log4J


Is it possible to configure xml file in such a way that it has different logging levels for diferent packages in java through Log4J ?


Advertisement
View Answers

February 29, 2012 at 11:29 AM



<--configure path according to your requrmts to save log file -->

<appender name="daoAppender" 
   class="org.apache.log4j.RollingFileAppender">   
    <param name="maxFileSize" value="100KB" />   
    <param name="maxBackupIndex" value="2" />   
    <param name="File" value="${jboss.server.home.dir}/deploy/myexampleprj.war/serverlogs/serverlogs.txt" />   
    <layout class="org.apache.log4j.PatternLayout">   
        <param name="ConversionPattern"  
               value="%d{dd-MMM-yyyy HH:mm};%5p %c %m%n" />   
    </layout>   
</appender>   

  <--configure path according for diff packge to your requrmts to save log file -->   

<!--appender name="appAppender"  
          class="org.apache.log4j.RollingFileAppender">   
    <param name="maxFileSize" value="100KB" />   
    <param name="maxBackupIndex" value="2" />   
    <param name="File" value="${jboss.server.home.dir}/deploy/myexampleprj.war/serverlogs/serverlogs.txt" />   
    <layout class="org.apache.log4j.PatternLayout">   
        <param name="ConversionPattern"  
               value="%d{ABSOLUTE} %5p %c{1}: %m%n " />   
    </layout>    
</appender-->   

<!??package name given in category here com is the package give package name  -->    

<!--category name="com.ex.actions">     
    <priority value="DEBUG"/>     
    <appender-ref ref="appAppender"/>       
</category-->

<category name="com">     
    <priority value="DEBUG"/>     
    <appender-ref ref="daoAppender"/>       
</category>    

<root>   
    <!--     
    <appender-ref ref="appAppender" />   
    <appender-ref ref="daoAppender" />   
    -->    
</root>



Related Tutorials/Questions & Answers:
Configuring Log4J
Configuring Log4J  Is it possible to configure xml file in such a way that it has different logging levels for diferent packages in java through Log4J
Log4j
Log4j  what is the use of log4j in realtime?   Please visit the following link: Log4j Tutorials
Advertisements
log4j
log4j  explain about log4j with example ?   Please visit the following link: log4j Tutorials
LOG4J
LOG4J  HOW AND WHERE TO FIND org.prot.appserver.config.Configuration; PACKAGE TO IMPORTIN LOG4J PREOGRAM
log4j - Log4J
log4j  could u pls help me out regarding the log4j coding   http://www.javaworld.com/javaworld/jw-12-2004/jw-1220-toolbox.html Thanks
Log4J - Log4J
Log4J  What is the use of Log4j? where does it use? Log4j is using for debuging ur code. Its does the same thing as System.out/System.err do. i.e to trace out ur program   Log4j is using for debuging ur code.Its does
log4j - Log4J
log4j  give me explanation about log4j,junit? how i hvae to use them   Hi mamatha, In Log4J, if you log a message at DEBUG level, and the current Appender is set to only log messages of INFO level and above
Configuring Hibernate
Configuring Hibernate  How to configure Hibernate?    The configuration files hibernate.cfg.xml and Mapping files *.hbm.xml are used by the Configuration class to create the SessionFactory which in turn creates
Installing the Driver and Configuring the CLASSPATH
Installing the Driver and Configuring the CLASSPATH  What is the procedure to Installing the Driver and Configuring the CLASSPATH mysql jdbc connector? the jar file
Log4j error - Log4J
Log4j error  Error while running tomcat server. SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener java.lang.NoClassDefFoundError: org
configuring a dll file in java.library.path
configuring a dll file in java.library.path  I am unable to configure .dll file in java.library.path in myeclipse ide tool
hi - Log4J
hi  Please give me the clear definition of Log4J and give me the example
java - Log4J
java  Q What is the real use for log4J?  Hi Friend, Please visit the following link: http://www.roseindia.net/tutorials/log4j/index.shtml Thanks
configuring websphere - WebSevices
configuring websphere  How to configure websphere in eclipse  Visit This Link adopt same kind of operation http://www.myeclipseide.com/documentation/quickstarts/blueedition/blue_connectors/ Thanks Rajanikant
Hibernate log4j
Hibernate log4j  Hi, when i run the FirstExample.java given in the tutorial, i got the right output, what my doubt is from where i am getting the log4j messages, like log4j:WARN no appenders could be found for logger
Log4J Architecture - Introduction to the Log4J architecture
. Configuring Log4J For running application using Log4J you need... Log4J Architecture - Introduction to the Log4J architecture... will learn about the architectural component of Log4J. Understanding
java - Log4J
regarding "LOG4J" and where these are exactly used in realtime application... as posible.   Hi Friend, Log4j is a logging package to help..., an OutputStream, a java.io.Writer etc. Using Log4j it is possible to enable logging
About configuring Servlet
About configuring Servlet  Hi I culdn't run Apache Tomcat (i already installed Tomcat 5.0 version) on Internet Browser.when i finished installing Tomcat i typed http://local host:8080/ in the internet Browser
Use of BasicConfigurator in Log4j logging
configured Log4j. There are many different ways of configuring Log4j. One way... Use of BasicConfigurator in Log4j logging       log4j warning log4j: WARN No appenders could
Steps to log4j configuration in Struts2
Steps to log4j configuration in Struts2  Hi... any tel me each step for configure log4j in struts2 application
log4j - Java Interview Questions
log4j  plz send me example program, using log4j and tel me how to execute that program.(what are the requirements to execute that program
configuring cron job - JSP-Servlet
configuring cron job  i decided to use cron job in ubuntu to send automatic mail.i programmed one jsp file that file will call a javafile, that javafile will check whether the client registration is going to expire
Difficulty in plugging log4J with Hibernate.
Difficulty in plugging log4J with Hibernate.  I am using Hibernate 3.6. Followed your all instruction of plugging log4j with my hibernate code... HandlingWorker, it uses SLF4j and does not detect log4J. What could
System Error messge - Log4J
System Error messge  Hi I am implementing log4j to my application I am getting this error message ?log4j: WARN No appenders could... Please initialize the log4j system properly.? I don?t have any Message
Updating log4j programatically
Updating log4j programatically  Is there a ready made utility which I can use to edit the log4j.xml programmatically
java log4j - Java Beginners
java log4j  which is the best site to prepare log4j in java since i am new to it  Hi Friend, Please visit the following link: http://www.roseindia.net/tutorials/log4j/index.shtml Hope that it will be helpful
log4j in web application
log4j in web application  Hi all, I am new to log4j. I want to use log4j in my web application. I need to write the debug,info,warn into a file. But i don't know how to do the same. Please send one example with explaination
Installing and configuring Tomcat server - Java Beginners
Installing and configuring Tomcat server  How to install and configure Tomcat server on desktop  Hi Friend, Please visit the following link: http://www.roseindia.net/web-application-server/tomcat/install
remove logging - Log4J
remove logging  How to remove the logging from crystal reports only? log4j hss been used for logging purpose.Thanks and regards vishal  hi friend,Crystal Reports XI is the definitive ?out of the box&#65533
configuring ready-made struts application - Struts
configuring ready-made struts application  I have a source of Struts project (web based apps) and need to configure it in order to be accessed via browser. The only information that I have was, the project is built on Struts
Log4J Tutorials: Using Log4J in Easy Steps
Log4J Tutorials: Using Log4J in Easy Steps Log4j is a logging library for Java... Software Foundation. Log4j is one of best Java logging frameworks used... statements into the code. Log4j has been designed with three objectives to provide
 

 

 

DMCA.com