Log4j: Logging Errors(No appenders could be found for logger)

hi,
i used logging in my java application. i placed log4j.jar and log4j.xml file paths
given in classpath.
i am getting 2 warning Messages. Those are as follows
Log4j:WARN. No appenders could be found for logger (Myclass.class)
Log4j:WARN. Use Log4j System Properly.
Here is what i done
log4j.xml is external configuration file. I specified Appender and layout
information in this.
Here is log4j.xml content...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="appender" class="org.apache.log4j.FileAppender">
<param name="File" value="C:\LOG\log.txt"/>
<param name="Append" value="false"/>
<layout class="org.apache.log4j.SimpleLayout"/>
</appender>
<root>
<priority value ="INFO"/>
<appender-ref ref="appender"/>
</root>
</log4j:configuration>
I specified appender and layout in log4j.xml file and placed log4j.xml file in
classpath.
How can i solve this problem?. Please help me.

Ok. I'm no log4j expert, but if you try to get a logger called Myclass.class and have not defined one in your xml file, there's a problem? Look at my xml file below, especially the category tag. Instead of putting "All" for the name, you would put "Myclass.class".
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="file" class="org.apache.log4j.FileAppender">
<param name="File" value="log/log.txt"/>
<param name="Append" value="true"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%l) - %m\n"/>
</layout>
</appender>
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.Out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %C{1}.%M - %m\n"/>
</layout>
</appender>
<!-- The All category -->
<category name="All" additivity="false">
<priority value="debug"/>
<appender-ref ref="file"/>
<appender-ref ref="console"/>
</category>
<!-- The one and only root category -->
<root>
<priority value="warn"/>
<appender-ref ref="console"/>
</root>
</log4j:configuration>

Similar Messages

  • Getting error as :  log4j : WARN No appenders could be found for logger

    Hi all,
    I am using IBM - Rational Application Developer (RAD) for the development of my project service task.
    I am trying to use log4j to log various events like errors and warnings and so on ....
    But I am getting following errors in console window of RAD :
    {color:#ff0000}
    [8/5/08 10:12:18:001 IST] 00000038 SystemErr R log4j:WARN No appenders could be found for logger (VINValidationService).
    [8/5/08 10:12:18:001 IST] 00000038 SystemErr R log4j:WARN Please initialize the log4j system properly.{color}
    If you have any clue regarding how to get out of this then it would be of great help to me .... please reply soon ....!
    (Please note that I have tried all the ways of setting CLASSPATHS and BUILDPATHS in the RAD) .
    --- Thanking you in advance ...
    Akshay_L.

    You could read these to get some hints [http://www.google.co.uk/search?q=%22Please+initialize+the+log4j+system+properly.%22]
    The first reply to the first hit on google says "log4j.properties needs to be on the classpath where log4j can find it.".
    You can set the system property if you wish but the classpath approach is the easiest in my opinion.

  • Log4j:WARN No appenders could be found for logger (Log4jExample).

    Hi,
    I am getting this error when I try to use log4j to generate logs.The program works fine if I keep log4j.properties file and my logging program in the same directory.
    If it is different directory,how to make it work ? like below.
    Any help in this regard is appreciated.
    Thanks
    Chat
    C:\mjava\test > dir
    Log4jExample.java
    C:\mjava\test >java Log4jExample.java
    log4j:WARN No appenders could be found for logger (Log4jExample).
    log4j:WARN Please initialize the log4j system properly.
    import org.apache.log4j.*;
    public class Log4jExample
        private static final Logger log =
            Logger.getLogger(Log4jExample.class);
        public static void main(String[] args)
            try
                log.debug("This is a debug message.");
                int i = Integer.parseInt("Hello world");
            catch (java.lang.Exception ex)
                log.error("Caught an exception", ex);
    C:\mjava>dir
    log4j.properties

    I'd recommend you use the classpath. But don't put log4j.properties in the parent directory of where your java class is, or the classpath will end up being incorrect. Try putting it in a separate directory tree, or as a child directory of where your class lives.
    Then add the classpath option to the runtime.
    java -classpath .;otherDirectory Log4jExample
    (where "otherDirectory" is the directory that contains log4j.properties)

  • Log4j: WARN No appenders could be found for logger

    Hi,
    I defined a log4j.properties file in my class directory:
    log4j.defaultInitOverride=false
    log4j.rootLogger=DEBUG, R, S
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=R.log
    log4j.appender.R.MaxFileSize=100KB
    log4j.appender.R.MaxBackupIndex=0
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
    log4j.appender.S=org.apache.log4j.RollingFileAppender
    log4j.appender.S.File=S.log
    log4j.appender.S.MaxFileSize=100KB
    log4j.appender.S.MaxBackupIndex=0
    log4j.appender.S.layout=org.apache.log4j.PatternLayout
    log4j.appender.S.layout.ConversionPattern=%p %t %c - %m%n
    Then I used the Logger in loginAction.java:
    private Logger logger = Logger.getLogger("R");
    logger.setAdditivity(false);
    logger.info("LoginAction");
    and in OracleDAOFactory.java:
    private Logger logger = Logger.getLogger("S");
    logger.setAdditivity(false);
    logger.info("Connected to DB from customer DAO");
    what I want to achieve is to record the information for loginAction in R.log and record the information for OracleDAOFactory in S.log. But do NOT add loginAction's information into OracleDAOFactory, and vice versa.
    The above codes work properly if I remove the line "logger.setAdditivity(false);". However the result is both log files have the contents. But if I add the line "logger.setAdditivity(false);", I get the following error message:
    log4j:WARN No appenders could be found for logger (S).
    log4j:WARN Please initialize the log4j system properly.
    What is wrong with my above coding?
    Thanks for your help!

    I don't know if this applies to your situation, but I just resolved this problem in my own environment. It turns out, I was attempting to log something in an area of my code before the logger had been configured by calling the configure method of the PropertyConfigurator class and passing in the file name of the properties file as the argument. It's important to set up log4j before attempting to log to the output file, and I called a debug method before it was set up.

  • Log4j Problem: No appenders could be found for logger

    I am migrating an existing app to log4j. I am using log4j 1.2.9. I have added the jar file to the classpath ahead of the weblogic classpath. I am using the log4j.xml file in the WEB-INF\classes directory. I get the following:
    log4j:WARN No appenders could be found for logger (com.kstorm.logging.compdir).
    log4j:WARN Please initialize the log4j system properly.\\
    From reading I get the impression it is a path/classpath problem. I then added the log4j.xml to the path and still got the error.
    Can anyone give me a hand with this?

    Hello,
    It looks like log4j has not found your log4j config file.
    Make sure your config file is present and visible to your application. Is your config file wrapped up in a war file?
    You may also see this error (rarely) if log4j is reading/picking up a differernt config file from the one you are expecting it to find (the one with your appender in it) in this unlikely case try searching for other possible log4j config files.
    Cheers
    Hussein Badakhchani
    www.orbism.com

  • Log4j:ERROR No appenders could be found for category

    Log not og

    In your top level class did you include a configurator?
    This is the minimum requirement:
    import org.apache.log4j.BasicConfigurator;
    BasicConfigurator.configure();Calling a configurator only needs to be done in the initialization of the application (not of each class), prior to the first call to log a message.
    I am responding to this because this thread about log4j got me thinging about a logging API and then to compare log4j to the Logger classes in 1.4. I started to use log4j and recalled that an error I saw was similar to your initial post.

  • Og4j:ERROR No appenders could be found for category

    Whats this mean and how do I recitfy the problem?

    You could read these to get some hints [http://www.google.co.uk/search?q=%22Please+initialize+the+log4j+system+properly.%22]
    The first reply to the first hit on google says "log4j.properties needs to be on the classpath where log4j can find it.".
    You can set the system property if you wish but the classpath approach is the easiest in my opinion.

  • Error:Administration header could not found for support message

    Hi All,
    we are creating the support message in CRMD_ORDER transaction. we are getting an error, "Administration header could not found for support message" while saving. And also it is coming out of the transaction.
    The transaction type is SLFN.
    Please advise.
    Regards
    kumar

    Did you find the solution to this error? I am also getting this error and need to solve the same. Can you please help?

  • Log4j:WARN No appenders could be found

    We are using weblogic 10.0.1 and JDK 1.6.
    We are using Log4j for logging, if I pass -Dlog4j.configuration=log4jconfig.xml in the startup script as a command line parameter weblogic console is displaying following warning messages. However, system properly initializes Log4j properly.
    Looks like beehive loggers are not initialized properly. In our log4jconfig.xml we have added appender for org.apache.
    log4j:WARN No appenders could be found for logger (org.apache.beehive.netui.pageflow.internal.AdapterManager).
    log4j:WARN Please initialize the log4j system properly.
    Please advise

    I've the same problem on weblogic 10.0.
    When the application code calls commons LogFactory for the first time, I see the following error messages.
    log4j:WARN No appenders could be found for logger (com.xxx.TestClass).
    log4j:WARN Please initialize the log4j system properly.
    Can someone explain why the same config file/setup works with Weblogic 8.1 but not with Weblogic 10.
    Thanks
    Kambiz
    Here is my folder structure
    -webroot
    +
    +-WEB-INF
    +classes
    | |--log4j.properties
    +lib
    +commons-logging.jar
    +log4j-1.2.15.jar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Project Server 2010 - Unable to open project, no valid Project Detail Page could be found for the project error

    I have a workflow being deployed for the first time on a farm. When I create a project with an EPT connected to the workflow it runs and can enter the required field in a PDP.  Then I Submit the workflow to go to the next stage and I get the "Unable
    to open project, no valid Project Detail Page could be found for the project" error.  After that the project is stuck on the same error.  All of the 18 stages have PDP and Schedules assigned to them.
    Any ideas on why the workflow cannot see the PDPs?  Is there a farm permissions that I am missing?  Thanks!

    Hi David,
    It starts to be a bit technical for me, but here is what I found on the web (seems to be an authentication issue with Sharepoint 2010):
    http://social.technet.microsoft.com/Forums/en-US/120ab535-63d2-4205-a51f-1987e9c0cf79/sharepoint-fba-the-content-type-texthtml-charsetutf8-of-the-response-message-does-not-match-the
    http://social.msdn.microsoft.com/Forums/silverlight/en-US/5cc70ff6-50d9-4cd3-b092-12007f4e495b/response-message-contenttypebindingtype-mismatch
    http://stackoverflow.com/questions/5263150/the-content-type-text-html-charset-utf-8-of-the-response-message-does-not-match
    Hope it will help you going forward in resolving your issue.
    Guillaume Rouyre - MBA, MCP, MCTS

  • Cannot update.  Get error message 1648, "no valid sequence could be found for the set of patches."

    Cannot update.  Get error message 1648, "no valid sequence could be found for the set of patches."

    Uninstall the corrupt Reader version using http://labs.adobe.com/downloads/acrobatcleaner.html then download and install the latest Reader from http://get.adobe.com/reader/enterprise/

  • Error 1706 No valid source could be found for adobe reader x

    Error 1706 No valid source could be found for productAdobe reader X (10.1.4) Install cannot continue.
    On programs that need adobe reader, the page will not come up.
    I tried to restoring my system to a point before when adobe was working, and tried to reinstall adobe reader.
    the download stops at 80% and reports: cannot find file  AdbeRdr1010_en_us(1).msi

    Remove your current installed Reader using http://labs.adobe.com/downloads/acrobatcleaner.html
    then download and run the full installer from http://get.adobe.com/reader/enterprise/

  • HP Scanjet G4050. Get "Error 1706.No valid source could be found for product ScannerCopy...."

    I just bought a new Scanjet G4050 and when I try to install the software I get an error message and the software will not install. Error message is:"Error 1706.No valid source could be found for product ScannerCopy. The Windows Installer cannot continue." During the install, I was prompted to enter a CD or other location to load ScannerCopy.
    I had an older version of this same Scanjet G4050 working on my PC about a year ago. My PC is running Vista 64.
    Any ideas how I can get the software to successfully load? Any ideas of where I can get this "ScannerCopy" that the software is asking for? 

    Remove your current installed Reader using http://labs.adobe.com/downloads/acrobatcleaner.html
    then download and run the full installer from http://get.adobe.com/reader/enterprise/

  • JSF1091: No mime type could be found for file xyz.png.

    Hi all,
    I get error logs in weblogic server like :
    <ExternalContextImpl> <getMimeType> JSF1091: No mime type could be found for file xyz.png. To resolve this, add a mime-type mapping to the applications web.xml.
    I get this for all the image files ... I found something :
    http://www.java2s.com/Code/JavaAPI/javax.servlet.http/webxmlmimemapping.htm
    <mime-mapping>
            <extension>java</extension>
            <mime-type>text/plain</mime-type>
    </mime-mapping>
    What should I add (mime-type) for png files ?
    Thanks..

    You use 'image/png' for this. Refer to MIME Types - Complete List » HTML Elements| Learn HTML | Tags | Tutorials | HTML Cheat Sheet for more info.
    Timo

  • JSF1091: No mime type could be found for file image_name.png

    Hi Experts,
    JDEV 11.1.2
    why this message shown in the log......? also how can i add a mime-type mapping ?
    <ExternalContextImpl> <getMimeType> JSF1091: No mime type could be found for file image_name.png. To resolve this, add a mime-type mapping to the applications web.xml.
    PMS

    Edit your app's web.xml and add it?
    Google can find you examples like [url http://www.java2s.com/Code/JavaAPI/javax.servlet.http/webxmlmimemapping.htm]this

Maybe you are looking for

  • Scrap Values in Variable Selection Screen

    Hi, When the end user is trying to select a filter value for the characteristic in a workbook, the selection value screen displays a lot of scrap values, when he closes the selection screen and tries again to select a filter value then it displays th

  • Using .mat as a control in LABVIEW

    Hi everyone I am interested to use .mat data as  a control in my LABVIEW program. As a simple program, if I display control value on any indicator I use only one control and one indicator. Now I am interested that control value would be the same valu

  • BME-99003:  An error occurred

    During mapping from database tables to Toplink classes (about 100 classes) i have such an error: Message BME-99003: An error occurred, so processing could not continue. Cause The application has tried to de-reference an invalid pointer. This exceptio

  • Debugging the webdynpro application

    hi     iam  trying to debug  my  webdynpro  application       its showing  as        selected  server node  doesnot  run in a restricted  load      balancing  mode           any suggestions ?

  • Prime 2.2 API och curl

    Hi! I have a question regarding Cisco prime and The api.. How can I extract the information under "Inventory, Network devices, switches and hubs" with Curl.. I have been successful in some curl questions, but need help with how to extract data under