ExceptionInInitializerError with logger

Hello,
when I run my application I'm always getting the following error:
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
     at helios.visual.PreferencesGUI.<init>(PreferencesGUI.java:48)
     at helios.visual.MainGUI.actionPerformed(MainGUI.java:672)
Caused by: java.lang.NullPointerException
     at helios.properties.LogProperties.init(LogProperties.java:63)
     at helios.properties.LogProperties.<init>(LogProperties.java:33)
     at helios.properties.LogProperties.<clinit>(LogProperties.java:15)
     ... 28 more
This is a piece of the code:
public class LogProperties
     private final static LogProperties instance = new LogProperties();
     //Logger
     static Logger logger = Logger.getLogger("helios.properties.LogProperties");
     //Objects
     private DirectoriesAndFiles df = DirectoriesAndFiles.getInstance();
     private Message m = Message.getInstance();
     //Other
     private File inputfile;
     private FileInputStream inputstream;
     private FileOutputStream outputstream;
     private Properties properties = new Properties();
     //Constructor
     private LogProperties()
          init();
     //Get instance of LogProperties
     public static LogProperties getInstance()
          return instance;
     //Load the properties from the appropriate properties file
     private void init()
               try
               logger.info("Loading LogProperties.");
               inputfile = new File(df.getPropertiesPath() + df.getLogPropertiesName());
               inputstream = new FileInputStream(inputfile);
               properties.load(inputstream);
          catch (IOException e)
               m.showErrorMessage(e.getMessage());
          finally
               try
                    inputstream.close();
               catch(IOException e)
                    e.printStackTrace()
          }So as soon as my application instantiates this LogProperties class I get this error.
I don't know if the fact that this is written according to the Singleton pattern has something
to do with it.
When I set the line "logger.info("Loading LogProperties.");" in comment, then the error is not thrown.
So as soon as my logger wants to log something I'm gettting into trouble.
Does anyone know what could be the problem here. It's giving me a headache.
Thx.
Message was edited by:
Mynca

Yes, it's because of static, as malcolmmc suggested. What he is also saying is:
Switch the order of the following two lines:
private final static LogProperties instance = new LogProperties();
//Logger
static Logger logger = Logger.getLogger("helios.properties.LogProperties");Then logger will be initialized first, and LogProperties will be able to be constructed.
Is logger used by other classes in the package? If not, it could be private and non-static, and then you could leave the order that you had.

Similar Messages

  • Problem with Logger setLevel() method in applet

    I am executing the following line of code in an applet:
    Logger.getLogger("Debug.log").setLevel(Level.ALL);
    I receive an AccessControlException, with e.getPermission()="java.util.logging.LoggingPermission control"
    When I do this in the policy file (following the manual, and the above direction):
    grant codeBase "file://C:/Documents and Settings/All Users/Documents/XMLEHT-Develop"
    permission java.util.logging.LoggingPermission control;
    I get this:
    java.security.policy: error parsing file:/C:/Documents%20and%20Settings/John/.java.policy:
         line 3: expected [;], found [control]
    When I do this in the policy file (incorrect, but following the above error message):
    grant codeBase "file://C:/Documents and Settings/All Users/Documents/XMLEHT-Develop"
    permission java.util.logging.LoggingPermission ;
    I get this:
    java.security.policy: error adding Permission, java.util.logging.LoggingPermission:
         java.lang.NullPointerException: name can't be null
    This problem occurs with JRE 1.5.0_14 installed. I also attempted re-installing Java, to no avail.
    Thanks in advance for any help you may provide.
    Edited by: John L. on Oct 26, 2012 12:33 PM

    As all are aware Java Applets run on the client and except in a corporate environment it is difficult to edit the policy file. Added to this is the problem caused by explicitly defining where the log file is to be written since even if only targetting at Windows the "Documents and Settings" may not be on the "C" drive and on Windows 7 "Documents and Settings" is not used.
    Since modifications to the policy file are not specific to a particular Applet they can be a security nightmare. When working with Applets it is normally best sign the Applet and then to only use a users home directory (System.getProperty("user.home")) or the temp directory (System.getProperty("java.io.tmpdir")) since these are pretty much guaranteed to be available.
    I'm not overly keen on Logging especially in Applets. To my mind Logging is primarily creating an audit trail (especially when things go wrong) and if the log file is on the client how is the Applet writer going to access the log file?

  • Annoying issue with Logger

    When I tell my FileHandler to append to an existing XML log file, it adds the follow two lines to the log file every time:
    <?xml version="1.0" encoding="windows-1252" standalone="no"?>
    <!DOCTYPE log SYSTEM "logger.dtd">
    This means that, if I have had hundreds of iterations of my loop, i get hundreds of XML headers in my log file, which seems asinine (not to mention the fact that a new LOG tag is created every time too). Is there anyway to prevent this from happening?

    I'm sure you'll just take issue with my response as well, based on a topic from the other day...
    but I'd have to say it sounds like you're using loggers for the wrong reason, if you think you need to append to an existing XML-based one. Maybe you should be logging to a flat text-based one instead, or shouldn't be integrating with (and dependent on) logger output to the degree that you are. There's probably a different design approach needed, but of course I'm not all that involved in your project. Just trying to point out that you may need to revisit the design instead of sticking with it the way you are.

  • Unmarshalling problem with special characters (Trademark, French

    I'm using a DefaultHandler class to create a StringBuffer which contains a single (though very complex) element from an XML file. I am unmarshalling this StringBuffer object to a JAXBContext like this:
    u.unmarshal( new StreamSource( new StringReader( sb.toString() ) )
    My special characters are going way out of whack (please read (TM) as the Trademark symbol)
    T-Force(TM) Ring(TM) Bonded iron construction for durability and longer life
    becomes
    T-Force���Ring ��� Bonded iron construction for durability and longer life
    Before I put anything else into the StringBuffer I put this in:
    sb.append("<?xml version=\"1.0\" encoding=\"iso-8859-15\"?>");
    But I've tried:
    sb.append("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
    and
    sb.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>");
    with different, but wrong, results.
    It's true that I'm viewing these results on a web page, so it's possible that the problem is occurring on the back end once I persist the data, but it looks like my database is set for UTF-8 (that's what I put for this new installation of Oracle 9i R2).
    Is there something basic I am missing. Like, perhaps, I need to do some sort of XML entity coding?
    Thank you very much for any help you can offer.

    Actually I had forgotten one additional thing. I have
    tried testing one thing at a time, and I have sent the
    special characters to the log file with logger.debug
    statements (log4j). The characters are screwed up in
    the log files, which is what makes me think I need to
    do some sort of entity encoding. (?)I don't think that log4j provides any way to declare the encoding it uses for your files. My guess is that it's using the default encoding for your system, which could be a problem for things like the trademark character. So log4j really gives you just another thing to test, rather than acting as a testing tool.
    I was thinking of a more low-level test, where you take your trademark character, which is 2022 or some such number (check the Unicode charts) and you write it to the database and read it back. Do you get the same character back? That sort of testing.

  • Proble with eclipselink 2.1.3 migration towards version 2.3.* or 2.4.*

    Hello guys,
    I ran into a problem last week when trying to deploy our application on Weblogic 12c. (12.1.1). Until now our application was running on weblogic 10.3.4.
    Several of our JPA queries do not compile/execute anymore due to the new eclipselink version : 2.3.1 embedded in weblogic 12.1.1.
    On weblogic 10.3.4 the JPA queries work fine (eclipselink version 2.1.3). On 12c, with eclipselink version 2.3.1, we get a ORA-0904 error on several queries. Eclipselink 2.3.1 does not compile the query into a correct native SQL query (same problem as http://www-01.ibm.com/support/docview.wss?uid=swg24022303).
    Error : Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00904: "T5"."M_FOR_ID_LIE": invalid identifier
    The JPA query :
    SELECT DISTINCT cla FROM Classe cla, IN (cla.aet.formation.MVfos) mvfo
    WHERE cla.ans = :ansCode
    AND cla.lycee.id = :lyceeid
    AND mvfo.ans = :ansCode AND cla.aet.niveauEtudes IN :nEtudes
    // Is a child of me selected?
    AND (EXISTS (SELECT mvfo2.id FROM MVfo mvfo2 WHERE mvfo.MFor.id = mvfo2.MFor.formationLie.id AND mvfo2.id IN :mvfoids)
    // Is the parent of myself selected?
    OR EXISTS(SELECT mvfo3.id FROM MVfo mvfo3 WHERE mvfo.MFor.formationLie.id = mvfo3.MFor.id AND mvfo3.id IN :mvfoids)
    // Is a "brother" of myself selected (and it's not me)?
    OR EXISTS(SELECT mvfo4.id FROM MVfo mvfo4 WHERE mvfo.MFor.formationLie.id = mvfo4.MFor.formationLie.id AND mvfo4.id IN :mvfoids AND mvfo.id <> mvfo4.id))
    ORDER BY cla.code
    The resulting SQL :
    SELECT DISTINCT t0.ID, t0.ALIAS, t0.ANS, t0.CLOTURE_P1, t0.CLOTURE_P1_NOTES, t0.CLOTURE_P1_REGENT, t0.CLOTURE_P2, t0.CLOTURE_P2_NOTES, t0.CLOTURE_P2_REGENT, t0.CLOTURE_P3, t0.CLOTURE_P3_NOTES, t0.CLOTURE_P3_REGENT, t0.CODE, t0.CONSEIL_P1, t0.CONSEIL_P2, t0.CONSEIL_P3, t0.DEBUT_SAISIE_P1, t0.DEBUT_SAISIE_P2, t0.DEBUT_SAISIE_P3, t0.FIN_SAISIE_P1, t0.FIN_SAISIE_P2, t0.FIN_SAISIE_P3, t0.FORMATION_NB_HEURES, t0.FORMATION_TAUX_PRESENCE, t0.FORMATION_TITRE, t0.LECONS_P1, t0.LECONS_P2, t0.LECONS_P3, t0.MAX_ELEVES, t0.MIN_ELEVES, t0.TRI1, t0.TRI2, t0.TRI3, t0.TRI4, t0.TYPE_HORAIRE, t0.AET_ID, t0.LYC_ID, t0.ENS_ID
    FROM AET t3, M_FOR t2, M_VFO t1, CLA t0
    WHERE ((((((t0.ANS = ?) AND (t0.LYC_ID = ?)) AND (t1.ANS = ?)) AND (t3.NIVEAU_ETUDES IN (?,?,?,?)))
    AND ((EXISTS (SELECT ? FROM M_FOR t7, M_FOR t6, M_FOR t5, M_VFO t4
                        WHERE (((t5.ID = t6.ID) AND (t4.ID IN (?))) AND (((t7.ID = t4.M_FOR_ID) AND (t5.ID = t1.M_FOR_ID)) AND (t6.ID = t7.M_FOR_ID_LIE))))
    OR EXISTS (SELECT ? FROM M_FOR t10, M_FOR t9, M_VFO t8
                   WHERE (((t9.ID = t10.ID) AND (t8.ID IN (?))) AND ((t9.ID = t5.M_FOR_ID_LIE) AND (t10.ID = t8.M_FOR_ID)))) )
    OR EXISTS (SELECT ? FROM M_VFO t11, M_FOR t13, M_FOR t12
                   WHERE ((((t9.ID = t12.ID) AND (t11.ID IN (?))) AND (t1.ID <> t11.ID)) AND ((t13.ID = t11.M_FOR_ID) AND (t12.ID = t13.M_FOR_ID_LIE)))) )) AND (((t3.ID = t0.AET_ID) AND (t2.ID = t3.M_FOR_ID)) AND (t1.M_FOR_ID = t2.ID)))
                   ORDER BY t0.CODE ASC
    The JPA get's confused with the scoping of the M_FOR table. We use the same table again in different subqueries. T5 is reused in the second qubquery which is wrong (it's not in the FROM). and thus we get a ORA-0904 error.
    So I was hoping that I could solve this problem by upgrading to JPA version 2.4.1 which I did using the following tutorial :
    http://docs.oracle.com/cd/E23943_01/doc.1111/e25034/tlandwls.htm#BABEDCEI Section 2.3.3 Task 3: Update the Version of EclipseLink in WebLogic Server.
    Basically I made a shared-library with the 2.4.1 JPA and reference it from our project.
    With the 2.4.1 version I run into a org.eclipse.persistence.exceptions.JPQLException on A LOT of queries even before the queries are compiled into native sql:
    I have simplified a query to make it understandable :
    Caused by: Exception [EclipseLink-0] (Eclipse Persistence Services - 2.4.0.v20120608-r11652): org.eclipse.persistence.exceptions.JPQLException
    Exception Description: Syntax error parsing [SELECT eleve FROM Eleve eleve WHERE CONCAT(eleve.nom, 'what is going on here') IN :modCodeList ].
    The IN expression does not have a valid expression
    I have the impression that the left side of a IN expression can't be a constant. If I put (eleve.nom IN :list) this query passes. If I put (1 in :list) the query fails for the same reason.
    I have double checked the runtime version of eclipselink with:
    logger.debug("ECLIPSELINK VERSION " + org.eclipse.persistence.Version.getVersionString());
    So to summarize, I have native sql problems (incorrect sql) with versions 2.3.* and I have parsing exceptions with versions 2.4.0 and 2.4.1. I suppose that with versions 2.4.* I will run into the same native sql problems of versions 2.3.* once all the queries parse.
    Versions 2.1.3 and 2.2.0 work.
    Has anyone any idea or experience with migration problems of weblogic and/or eclipselink. Any help would be very appreciated.
    Thanks in advance for your help.
    David

    EclipseLink 2.4 uses the Hermes parser by default instead of the ANTLR parser used previously, so that might explain the parsing error differences. Both issues should be filed as bugs, but it might be that once the 2.4 parse error is fixed or a workaround provided to generate the correct SQL - the code generated by the two parsers can be slightly different.
    But please file both issues with as simple a test case reproduction as possible, and remember to vote for each if filed on EclipseLink instead of through Oracle support.
    Best Regards,
    Chris

  • How can i built a java application using java debug class on Log4J

    Hi,
    As java API support the MethodEntryEvent, using which I can get the automatic logging statements when the method is entered or exited as HelloExample.main(with argument type).
    Where HelloExample is the class name.
    Main is the method entered with its argument types.
    In some cases I have the o/p as
    -- VM Started --
    ====== main ======
    main -- HelloExample
    callerMethod -- HelloExample
    ====== main end ======
    -- The application exited --
    By using Log4J is there any possibility of getting these sort of o/p along with the loggers supported by Log4J. i mean to say can i built an java application which supports the MethodEntryEvent and MethodExitEvent from java API and also uses the Log4J debugging. I took an e.g. trace example, which (in J2SE 1.4.x or 5.x) will be found in $JAVA_HOME/demo/jpda/examples.jar and unpacking it by
    jar -xvf $JAVA_HOME/demo/jpda/examples.jar i found the com/sun/tools/example/trace/Trace.java and passed the class constructed with logger taken from Log4J. In this case the logging message is displayed on the console. As per the requirement i need to transfer the whole o/p to an output file along with Log4J logger statements. in this case i should not give any command in the cosule except compiling and executing the programme. the programm also should able to run without the main() as i need to integrate Log4J with an application and the code must me application server independent. i need the output as i got using MethodEnteryEvent (shown as above) in case of java application built using Log4J.
    Can any one help me in this regard. can any one give me some suggestion or any programme of this sort. All suggestions are welcomed.
    Thanks & Regards,

    hi,
    can someone help me how to implement logging for method entry parameters and
    method exit return value.
    can someone help me how to use log4j and integrate it to the method entry
    logging and method exit logging.
    Here what i need is without writing the log statements for the method entry and
    method exit i need to log it to the file
    along with other log4j debug statements i provide in the file.I should be able
    to configure whether to enable/disable the logging
    for method entry and method exit. In method entry i should be able to log the
    parameters the method take and in method exit
    i should be able to log te return value to the log file, before the method is
    returned to the callee.
    i hope i am clear
    Thanks in advance.

  • Getting no output from java.util.logging.FileHandler

    I am new to Java as is the company I work for, but we have just landed a contract that specifies J2EE as the platform, so here we are. :-) Please bear with me.
    I have been charged with determining our logging architecture and it looks like what is available in java.util.logging will do well (though we may use log4j). However, at this point I am just trying to get anything to work and not having much luck.
    We are using JSF on the front end and I have created a very simple JSF page to test logging. The relevant code is below and I hope will be self explanatory: This code is not meant to be efficient or anything. It is just a proof of concept.
        public String button1_action() {
            // User event code here...
            try {
                Logger l = java.util.logging.Logger.getLogger(Page1.class.getName());
                l.entering(Page1.class.getName(), "button1_action");
                l.info(this.textField1.getValue().toString());
                l.exiting(Page1.class.getName(), "button1_action");
                java.util.logging.Handler h = l.getHandlers()[0];
                h.flush();
            catch(Exception ex) {
                //I have tested this and we aren?t catching any errors.
                System.err.println(ex);
            return "";
        }My logger.properties files looks like this:
    handlers= java.util.logging.FileHandler
    .level= FINEST
    java.util.logging.FileHandler.pattern = c:/sun/logs/test-%u.log
    java.util.logging.FileHandler.limit = 50000
    java.util.logging.FileHandler.count = 1
    java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatterI have developed and tested this in Sun Studio Creator 2004Q2 What is happening is that I am getting three log files in c:/sun/logs
    test-0.log, test-1.log and test-2.log. The first two contain output from various sun components. (sun.rmi.transport for example). The third log remains empty. (zero length)
    I have also deployed the test app to a tomcat 5.0.28 server and get similar results. The only difference is I get only one two log files and the second one remains empty.
    Any assistance or suggestions as to what direction I should be taking would be appreciated.
    --Ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Do not use default logger as getLoggers[0] , but use your java.util.Logger.FileHandler and add filehandler object to log your fButtonActions and you do not need to mess with logger.properties too.

  • Navigate to selection screen from ALV.

    Hi All,
    I am using ALV in my report which is editable alv. when i save after edit one more alv is generated with loggs. but when i click on back tab from application toolbar it navigate to previous alv. But i want to navigate to selection screen. so how to achive it.
    i have defined my own PF status and i tried following code which gives short dump.
    IF sy-ucomm = 'BACK'.
        SET SCREEN 1000.
        LEAVE TO SCREEN 1000.
      ENDIF.
    thanks ,
    Swarup.

    Hi Swarup,
    I have implemented the exact scenario, this is what you need to do.
    FORM f_alv_user_comm USING i_ucomm TYPE syucomm           
                              i_rs TYPE slis_selfield.
    *  Display ALV2 (This list shows the list blocked/unblocked customers)
        PERFORM f_display_alv2 CHANGING i_ucomm.
      IF i_ucomm EQ '&F03'.         " here you can use the back button code
    * Return to seletion screen
        LEAVE TO SCREEN 0.
      ENDIF.
    endform.
    In f_display_alv2 do like this :
    FORM f_display_alv2 CHANGING e_ucomm TYPE syucomm.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_bypassing_buffer = c_mark
            i_callback_program = w_repid
            is_layout          = lws_layout
            it_fieldcat        = int_fieldcat2[]
            it_events          = int_events_alv2
          TABLES
            t_outtab           = int_alv2_out
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSE.
          e_ucomm = '&F03'.                          " This will take the back button code
        ENDIF.
    endform.
    This is the right way to do it.
    Regards,
    Salil Sonam

  • Garbage added to log while sending message to Weblogic JMS topic

    Hi All,
    Was able to sucessfully send messages to Weblogic JMS topic and also able recieve them.
    But while sending the messages to topic loy of debug statements are printed to the standard output
    This is seen only in production and not in developement, and expecting it due config issue...
    Any ideas on this is greatly appriciatied.
    Thanks in advance !
    Cheers,
    Ambha

    Thanks for the replies,
    The problem is certainly not with logger settings...
    The statements which are getting printed are SSL debugging
    The following settings are used by the application which sends messages to the topic :
    Dssl.debug=true
    Dweblogic.StdoutDebugEnabled=true
    These settings are same in Dev, UAT, and Production. But why the debug statements are seen only
    in UAT and Production I am not sure...
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    any Ideas... ?
    Thanks
    Ambha

  • Exception in static block + re-instantiating

    Hello All,
    I have got a number of unit tests and one that is running is causing an exception in a static block of a class which is expected. It throws an ExceptionInInitializerError which I catch in the unit test.
    But then another test is running using the same class and this time it should pass and create an instance of the same class as before.
    But instead I receive a java.lang.NoClassDefFoundError with no class name. Why? Can't I instantiate a class again once the initialisation had failed?
    Regards
    Jonas

    It's part of the VM Specification.
    See [2.17.5 Detailed Initialization Procedure|http://java.sun.com/docs/books/jvms/second_edition/html/Concepts.doc.html#24237]
    The first time,
    10. Otherwise, the initializers must have completed abruptly by throwing some exception E. If the class of E is not Error or one of its subclasses, then create a new instance of the class ExceptionInInitializerError, with E as the argument, and use this object in place of E in the following step. But if a new instance of ExceptionInInitializerError cannot be created because an OutOfMemoryError occurs, then instead use an OutOfMemoryError object in place of E in the following step.After that,
    5. If the Class object is in an erroneous state, then initialization is not possible. Release the lock on the Class object and throw a NoClassDefFoundError.

  • Log Levels

    Hi,
    In my application I use a lot of info/debug printouts with the method log which writes to the appservers (sun appserver 8) log file (server.log). Log method called with a string (log("message")) seems to give Log Level INFO in server.log. Now I want to get rid of the info messages without actually removing them from the source code. Easy, I thought, just to change Log Level from INFO to WARNING for module Web Container in the appserver (with admin console) because the help page says "The default level is INFO, meaning that messages at that level or higher (WARNING, SEVERE) will appear in the log". The result was not what I expected, the log posts did not disappear, instead the log level changed from INFO to WARNING!!!
    In my next try, I used System.out.println for my info messages instead of method log. This also writes log posts, with log level INFO, to server.log with logger name javax.enterprise.system.stream.out. To turn off the logs the help page says "specify the logger name with the value OFF in the Additional Properties area". That is exactly what I did (yes, I also restarted the appserver) but the log posts are still written to server.log.
    No more ideas.
    Am I misunderstanding something, bugs in appserver or what?
    Regards
    Mats

    Maybe you need to implement Java Logging in your application. Check out the below URL for more details :
    http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/
    Once you have implemented Java logging, you need to edit either <jdk_home>/jre/lib/logging.properties and include something like this :
    com.util.level = INFO
    com.servlet.level = SEVERE
    (Assuming com.util and com.servlet and two packages in your application, all Java classes in com.util will log only INFO and above messages and all Java classes in com.servlet will log only SEVERE messages).
    Alternatively, you can also add the above properties in the Logger Settings tab from the admin GUI.
    Hope that helps
    Cheers,
    Vasanth

  • Log4j And Tomcat

    Hi,
    I'm trying to get log4j to work with tomcat, but for some reason none of the logs get written to the logfile.
    I have a logfile containing:
         <appender name="apachelog" class="org.apache.log4j.FileAppender">
              <param name="File" value="${catalina.home}/logs/junk.log"/>
              <layout class="org.apache.log4j.PatternLayout">
                   <param name="ConversionPattern" value="%d %-5p (%F:%L) - %m%n"/>
              </layout>
         </appender>
         <logger name="org.apache.jk.common.ChannelSocket">
                <level value="info"/>
                <appender-ref ref="apachelog"/>
         </logger> 
    ...Except the tricky thing is that though I don't have access to the source code for this jk.common class, I'm getting a ton of "INFO" logs from it, and I don't want them showing up on the console.
    I've tried adding a line logger = Logger.getLogger("org.apache.jk.common.ChannelSocket") in my classes, but that doesn't work. In fact, under tomcat, I can't even get logging working for my other classes!
    The logfile is getting picked up by tomcat (If it isn't configured properly, tomcat gives me errors on startup). The specified log folder is empty, and the output still goes to the console.
    Can someone please help?
    Thanks.

    It doesn't seem to work unless I actually call getLogger() & then call info manuallyI don't follow. What doesn't work? Your code always needs to call getLogger("somename") followed by logger.info("Some message"); in order to log an INFO message.
    If only there was some way to associate a logger with a class during runtimeLogger's aren't directly associated with classes at all. Every logger has a name and by convension the name is the same as class that creates / uses it..
    Logger.getLogger("com.somepackage.anotherpackage.MyClass");could be replaced with
    Logger.getLogger("debugLogger");The reason for using the fully qualified class name is so that you can turn on/off logging by package or by class, e.g.
    <logger name="com.somepackage">
        <priority value="OFF"/>
    </logger>Turns off all logging for every logger with a name that starts with "com.somepackage". The fact that just happens to be a package name is irrelevant.
    I appreciate your help so far, but I'm really stumped as to why1)Logging happens to the console instead of the logfile
    2)It bypasses the logger.info() method somehow
    Tomcat uses commons logging, which in most cases uses Log4J behind the scenes. Is it possible you've instead managed to enable the logging that comes with J2SE? Download the Tomcat source, put a break point at the line that reads log.info( "connection timeout reached"); and see where it takes you when you step through.

  • Garbage added to log file while sending messags to weblogic JMS topic

    Hi All,
    While I am sending messages to JMS Topic some debug statements are printed to stdout...
    which is only happening in production rather than in dev environment, hence I feel this is a configuration issue..
    sheding light on this issue is greatly appreciated,
    thanks in advance !
    regards,
    Ambha

    Thanks for the replies,
    The problem is certainly not with logger settings...
    The statements which are getting printed are SSL debugging
    The following settings are used by the application which sends messages to the topic :
    Dssl.debug=true
    Dweblogic.StdoutDebugEnabled=true
    These settings are same in Dev, UAT, and Production. But why the debug statements are seen only
    in UAT and Production I am not sure...
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    *<Some TIME IST> <Debug> <TLS> <000000> <......>*
    any Ideas... ?
    Thanks
    Ambha

  • ADF Logs dispaly in Custom Application

    Experts,
    In any Jdev 11g application, when we are using ADF Logger we can check the logs in EM. I want to do the same but im my custom application. For eg. on admin login i want to enable and see the logs on the page itself. Any inputs on how to do this ?
    thnks

    Thats cool. But lets make this situation real time.
    Use Case :
    Application page has some tabs, some lovs, some tables which on clicking opens some data in popups etc. Application is deployed on the external weblogic server whose default logging level is Warning.
    The application has a Sql query tracing file which prints out the query getting executed along with the parameters. The query is printed with logger set to debug i.e. print them only when the logging level changes to debug.
    Now lets say on the page the user clicks on the button which loads a data in table in a popup. The user can scroll down to see the list of data. This concept will work on PPR (opening of a popup and displaying of data). Lets say there is some issue here like its showing "Fetching Data" for only one user - for rest of the users it is perfect.
    The support engineer need to check what is the query that is getting executed. So
    1) He will need to change the logging level
    2) Get access to the logs
    3) Reset the logging level again.
    these are just on top of my head right now.
    Going by what John said (i need to learn more on ECID) ECID for each page might do the trick but what about PPR ? What about changing the logging level ? etc.
    thnks

  • Log4j message Problem

    Problem description: my logger.info statements from my classes are logged in to the app.log file which is my application log file and also on my Websphere console (System out.log ) staements are displaying , actually my requirement is to see logger statements in my application log file i.e. (app.log file) but not in console. how to stop my logging statements to appear in console?
    Is thereanything i am missing here !!!
    I am loading log4j. properties using the following line in one of my classes ...
    PropertyConfigurator.configure(/usr/log/log4j.properties);
    Log4j.properties
    log4j.rootLogger=ERROR
    # Specify where to log by packages.
    log4j.logger.com.abc.example=INFO,dest1
    log4j.appender.dest1=org.apache.log4j.RollingFileAppender
    log4j.appender.dest1.File=app.log
    log4j.appender.dest1.MaxFileSize=10000KB
    log4j.appender.dest1.MaxBackupIndex=30
    log4j.appender.dest1.layout=org.apache.log4j.PatternLayout
    #log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    #log4j.appender.stdout.Target=System.out
    #log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    #log4j.appender.sdtout.Threshold=ERROR
    Thanks in Advance,
    J.P.Sastry (SCJP,SCWCD,SCBCD)
    Edited by: PunnayyaSastryJandhyala on May 8, 2008 8:07 PM

    don't use System.out.println, it always prints at server console.
    in fact we implement LOG4J to avoid writing System.out.println statements, log all System.out.println statements with Logger.info.
    pvmk
    Edited by: pvmk on May 9, 2008 12:29 AM

Maybe you are looking for

  • Mac Mini and gaming

    I have an iMac G4 (fist generation). It still serves our needs admirably while looking stylish. Some of the new games my son would like to play require a faster CPU and a newer graphics card. Is there some way that I could connect or network a Mac Mi

  • IP local pool range not accepted

    I have a client set up with this range: ip local pool ClientVPN 176.16.11.210-176.16.11.241 Somehow it is unable to give an IP to the client... If i change the range: ip local pool VPNproduction 176.16.11.150-176.16.11.160 It works fine... What could

  • Problems since upgrading to Mavericks

    I am experiencing problems with CC applications since upgrading to Mavericks. Mostly Screen and display issues. In Photoshop, the top menu bar where the red, yellow , green window buttons normally sit has disappeared and it seems I cannot drag the wi

  • QTP 11 and Flex 4.5

    I am using QTP 11, Windows 7 64bit PC, Flex 4.5, on IE9. I am able to identify objects in the record mode and they do get added to the local object repository. However, when using QTP with Object Spy or (Object Repository > Object > Add Objects to Lo

  • Force logging for data guard

    It is my understanding new to version 11g force logging is not required on the database? So we could setup a tablespace for staging tables in no logging and not generate as much redo to be shipped over to the standby? Is this true or was that feature