Using Log4j with Listener

We are using Log4j and all of our logging files are properly created by a
listener that starts once our application is deployed. All logging works
fine when we are running in single server mode but when we deploy the EAR to
a cluster, the listener starts and we see the log files created and there is
an initial line written into one of the created log files by the listener.
When we access our application on the cluster non of the logging messages
are written out to the files. I am thinking that maybe the listener is
dieing but I am not sure. We have a log4j config file that is included in
our WEB-INF directory.
Is there a way to see what listeners are running?
Has anyone used log4j in a clustered environment?
Thanks
Michelle

We have managed to get a little further. When the managed servers are
          started up by the admin server, and application is deployed, the log files
          are created by the listener BUT when we access the application nothing is
          written to the logs. We have not located any exceptions, the logs just
          don't seem to get written to. Now, if redeploy the application it properly
          logs to the log files. Any ideas??? Again, our log4j config file is in
          the WEB-INF directory in the EAR and the web.xml has an entry for
          log4j-init-file pointing to the WEB-INF log4j file. We have deployed our
          application to production and I just don't like the fact that if the servers
          must be rebooted that our application must be redeployed. If this step is
          missed then we won't be logging and of course troubleshooting goes out the
          window. Any help greatly appreciated
          I will have to double check if we have a try catch block. If not I will do
          this pronto.
          <Srinagesh Susarla> wrote in message news:[email protected]..
          > log4j should work the same both on single server as well as clustered env.
          > Can you try adding some debug to your listener to ensure that its getting
          > initialized correctly. Also can you surround it with a try catch block to
          > ensure that its getting loaded correctly.
          > Another question: Is this a ServletContextListener or an
          > ApplifecycleListener?
          > If there are any exceptions please post them here.
          >
          > -- Nagesh

Similar Messages

  • Using log4j with portal server

    Hi,
    I am trying to use log4j with Portal server 6.1 using log taglibs from jakarta.
    Here is what i've done:
    1. copy taglibs-log.jar in /etc/opt/SUNWps/desktop/classes
    2. copy taglibs-log.tld in /etc/opt/SUNWps/desktop/default/tld
    3. put log statements in JSPs
    for example:
    <log:debug>This is body content.</log:debug>
    <log:debug message="This is attribute content." />
    4. /etc/opt/SUNWps/desktop/classes/log4j.properties contains
    =========================================
    # Sample properties to initialise log4j
    log4j.rootCategory=debug, stdout, R
    #log4j.rootCategory=debug, stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    # Pattern to output the caller's file name and line number.
    log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=logtags.log
    log4j.appender.R.MaxFileSize=100KB
    # Keep one backup file
    log4j.appender.R.MaxBackupIndex=2
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
    ===============================================
    However no log file is created on my system. I am very new to this and would appreciate if anyone could tell me what more needs to be done to get log records in a file.
    Thanks for all your help.
    Kind regards,
    Apoorv

    Hi,
    I am trying to use log4j with Portal server 6.1 using
    log taglibs from jakarta.
    Here is what i've done:
    1. copy taglibs-log.jar in
    /etc/opt/SUNWps/desktop/classes
    2. copy taglibs-log.tld in
    /etc/opt/SUNWps/desktop/default/tld
    3. put log statements in JSPs
    for example:
    <log:debug>This is body content.</log:debug>
    <log:debug message="This is attribute content." />
    4. /etc/opt/SUNWps/desktop/classes/log4j.properties
    contains
    =========================================
    # Sample properties to initialise log4j
    log4j.rootCategory=debug, stdout, R
    #log4j.rootCategory=debug, stdout
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternL
    ayout
    # Pattern to output the caller's file name and line
    number.
    log4j.appender.stdout.layout.ConversionPattern=%5p
    [%t] (%F:%L) - %m%n
    log4j.appender.R=org.apache.log4j.RollingFileAppender
    log4j.appender.R.File=logtags.log
    log4j.appender.R.MaxFileSize=100KB
    # Keep one backup file
    log4j.appender.R.MaxBackupIndex=2
    log4j.appender.R.layout=org.apache.log4j.PatternLayout
    log4j.appender.R.layout.ConversionPattern=%p %t %c -
    %m%n
    ===============================================
    However no log file is created on my system. I am
    very new to this and would appreciate if anyone could
    tell me what more needs to be done to get log records
    in a file.
    Thanks for all your help.
    Kind regards,
    Apoorv

  • Can I use log4j with a java stored procedure

    I have code that resides on the middle tier and on the database. Our company is using log4j for debugging purposes. In order to get my code to work on the database, I have had to remove all the log4j stuff. Has anyone tried to get code that has log4j messages to run on the database? I am not concerned with actual debugging, I just don't want to have to strip this code out if I can avoid it.

    Hi Laura,
    As far as I know, you have two choices:
    1. Load the log4j classes into the database (using the "loadjava" tool).
    2. Enable remote invocation of log4j classes via RMI (or similar).
    Hope this helps.
    Good Luck,
    Avi.

  • Using log4j with JavaFX and Netbeans 6.8

    Hello,
    I'm trying to use log4j within a JavaFX project using NetBeans 6.8.
    I've donwloaded the .zip file from the Apache website and added the log4j-1.2.16.jar to the project's libraries.
    Then I added the imports:
    import org.apache.log4j.Logger;
    import org.apache.log4j.BasicConfigurator;But using the Logger class does not work:
    def log:Logger = Logger.getLogger("MyApp.class");NetBeans says 'cannot find symbol'
    When I'm doing the same things within a Java project, everything works fine.
    What am I doing wrong?
    thanks
    Edited by: Lichti on Apr 17, 2010 12:08 PM

    To answer my own question ... there's a known bug in NB 6.8 with including JARs.

  • Using log4j with WLS7.0 SP2

    Hello,
    I'm trying to start using log4j. It seems to work fine initially after the
    server starts up. But if I make a modification to any of the logged classes
    and recompile them, log4j errors out saying it cannot find an appender for
    the category specified. log4j.jar is in the classpath of the WLS startup
    script. Has anyone come across this problem? I'm not quite sure what the
    source of problem is. And it is not really productive to restart the server
    every time anything changes in one class...any insight is appreciated!
    Thank you,
    Makoto

    Oops. I solved my own problem. I turned off "Prefer WEB-INF classes" in the
    console and the problem went away.
    mk.
    "Makoto Suzuki" <[email protected]> wrote in message
    news:3f034462$[email protected]..
    Hello,
    I'm trying to start using log4j. It seems to work fine initially after the
    server starts up. But if I make a modification to any of the loggedclasses
    and recompile them, log4j errors out saying it cannot find an appender for
    the category specified. log4j.jar is in the classpath of the WLS startup
    script. Has anyone come across this problem? I'm not quite sure what the
    source of problem is. And it is not really productive to restart theserver
    every time anything changes in one class...any insight is appreciated!
    Thank you,
    Makoto

  • Problem in Using Log4J with Weblogic 9.2

    I am using Weblogic 9.2 and Log4j.
    By using Admin console I set the Severity Level to WARNING and inside my java code is given below:
    Logger logger = Log4jLoggingHelper.getLog4jServerLogger();
    if (logger.isEnabledFor(Priority.DEBUG)){
    logger.debug("DEBUG - Test Debug message");
    logger.info("DEBUG - Test Info Message");
    logger.warn("DEBUG - Test Warning Message");
    logger.error("DEBUG - Test Error Message");
    logger.fatal("DEBUG - Test Fatal Message");          
    Somehow the logger.isEnabledFor(Priority.DEBUG) returning 'TRUE' and the follwoing message is displayed.
    <Nov 29, 2006 2:44:04 PM EST> <Warning> org.apache.log4j.Category> <000000> <DEBUG - Test Warning Message>
    <Nov 29, 2006 2:44:04 PM EST> <Error> <org.apache.log4j.Category> <000000> <DEBUG - Test Error Message>
    <Nov 29, 2006 2:44:04 PM EST> <Info> <org.apache.log4j.Category> <000000> <DEBUG - Test Fatal Message>
    <b><i>NOTE - The logger.debug() and logger.info() methods are not invoked because of the severity level to 'WARNING' in the console.</i></b>
    <b>I would like to know why the Somehow the logger.isEnabledFor(Priority.DEBUG) is having a value of 'TRUE'.</b>
    I expected only the Somehow the logger.isEnabledFor(Priority.ERROR) will have the value of 'TRUE'.

    Did you get an answer to your question? I have the same problem with WebLogic 10.0.

  • Using log4j with Collab 4.1SP1

    We are trying to Roll collab files every 25MB. When I change the collab appender to org.apache.log4j.RollingFileAPpender, java throws a "java.lang.ClassCastException" exception. We are using Collab 4.1SP1 with Plumtree 5. Here is the audit.xml file that I've tried:
    <?xml version="1.0" encoding="UTF-8"?>
    <plumtree>
    <log enabled="yes">
         <appender class="org.apache.log4j.RollingFileAppender" name="CoreAppender">
    <param name="File" value="$configRootDirectory/logs/collab.log"/>
    <layout class="com.plumtree.openlog.log4jbridge.MyPatternLayout" />
              <param name="MaxFileSize" value="25MB" />
              <param name="MaxBackupIndex" value="10" />
         </appender>
         <appender class="com.plumtree.core.audit.log.ConsoleAppender" name="STDOUT">
              <layout class="com.plumtree.core.audit.log.PatternLayout">
    <param name="ConversionPattern" value="%d %-5p [%t] %C{2} (%F:%L) - %m%n"/>
              </layout>          
         </appender>
         <category name="com.plumtree">
         <priority value="debug"/>
         <appender-ref ref="CoreAppender"/>
         </category>
    <!--      
         <root>
         <priority value ="error" />
         <appender-ref ref="STDOUT" />
         </root>
    -->      
    </log>
    <openlog enabled="yes">
    <serverName value="[Server Name]"/>
    <restrictToLocalMachine value="no"/>
    </openlog>
    <profiler enabled="no">
    <http enabled="yes" log="yes" log-headers="no"/>
    <jdbc enabled="no" log="no"/>
    </profiler>
    </plumtree>

    Looks strange to me. RollingFileAppender is a subclass of FileAppender so it has to work because there is no need for casting at all here.
    Does it always work fine for FileAppender?
    If so does somebody can provide example how subclassing can couse this type of error?

  • Using log4j with studio

    All,
    I was able to get the log4j working with BPM in Weblogic environment. However I am running into some issue truing to get that done in studio.
    In Weblogic Env. I place the log4j.properties file under in a folder called resources under the Domain Root and the java code is able to read the file.
    I am not sure what should be the equivalent of Domain Root in the studio env. I tried to create a file and it gets created under "C:\OraBPMStudioHome\eclipse" in my installation. I tried to create a log file under the logs directory @ the same location and it works file .
    Unfortunately I am not able to read the log4j.properties if i keep it @ this same location.
    in my Java code I read the file as this
    private static final String DEFAULT_PATH = "resources/log4j.properties";
    My question is to all you gurus out there , how can i make it work in studio. Do i have to setup something special to get this working in studio.
    -Thanks

    I was wondering if someone has faced this issue and knows how to resolve this.
    -Thanks

  • Log4J with Weblogic Server 10

    Hi,
    We are migrating an EJB application from Weblogic 8.1 to Weblogic 10.0
    In the current configuration, we simply include the following in the server startup script, so as to specify the log4j configuration file, and this takes care of the logging part.
    -Dlog4j.configuration=file:<complete file name>
    The same thing doesn't work with WL 10. Is there any other (special) way of using Log4j with WL 10?
    Note that inside the code, we use commons-logging to get hold of the logger as follows:-
    org.apache.commons.logging.LogFactory.getLog(class)
    I would be grateful for any help on this.
    Thanks in advance.
    Regards,
    Neelesh

    Tricky questions.. this problem needs more analysing. I see that you are on R27.6.0, we've come with a few updates to that one. Download the latest greatest and see if that works things out: http://www.oracle.com/technology/software/products/jrockit/index.html. If not, then report this issue to JRockit support (see how to below)!
    Best Regards,
    Tuva
    JRockit PM
    How to report to JRockit support:
    You must register and file the issue on Metalink, http://metalink.oracle.com. Note that you must have purchased support to continue.
    If you have problems during the registration or filing you can call our support +1.800.223.1711* or 1-800-633-0738 directly.
    In case you have not purchased support call 1.800.833.3536* for support sales.
    More information on our support site: http://www.oracle.com/support/index.html.
    *) US numbers - for global technical support contacts see: http://www.oracle.com/support/contact.html

  • Using log4j in jdk1.4

    Hi,
    I'm Babu. I am wanting to know about the how to of using log4j in jdk 1.4.
    Babu.

    Do you have a question specifically about how to use log4j in jdk 1.4? There's nothing different when using log4j with jdk 1.4 than with other versions. Put log4j.jar in your classpath. Read the log4j documentation.
    Jesper

  • Using log4j in the weblogic

    Hi,
    I am using log4j in weblogic i am using 1.2.8 version but i am getting some exception
    after another exception can you please tell me what should i do if i have to use
    log4j with weblogic
    thanks
    Arun Purang

    Pedro Salazar <[email protected]> wrote:
    orj.log4j.Logger class.Could be you mistyped your package name here. Use "org.log4j.Logger".
    WebLogic 8.1 SP2 comes with log4j.jar in ${BEA_HOME}/weblogic81/common/lib. Looks
    like it's Log4j 1.2.8.
    I've used Log4j from within an authentication provide with no problems but an
    authentication provider probably runs in the application server context.
    If you want to use log4j in your application, won't you need to add log4j-1.2.8.jar
    (or whatever) to your WEB-INF/lib or modules directory or something?

  • Using log4j v.1.2 with Weblogic 7.0

    I try to use logging pissibilities of Log4j with Weblogic 7.0 using com.bea.logging.WeblogicAppender
    class from logtoolkit.jar.
    When I use Weblogic's version of Log4j (v. 1.1.3), all is OK. When I try to use
    current version of Log4j (v.1.2.6), I receive java.lang.NoSuchFieldError: priority
    at com.bea.logging.WeblogicAppender.append(Unknown Source)
         at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
         at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
         at org.apache.log4j.Category.callAppenders(Category.java:187)
         at org.apache.log4j.Category.forcedLog(Category.java:372)
         at org.apache.log4j.Category.info(Category.java:674)
         at com.mydomain.framework.log.Log4JLogger.logInfo(Log4JLogger.java:73)
    There is configuration file:
    <log4j:configuration>
    <appender name="WeblogicAppender" class="com.bea.logging.WeblogicAppender">
         <layout class="org.apache.log4j.PatternLayout"></layout>
    </appender>
    <root>
    <priority value ="debug" />
    <appender-ref ref="WeblogicAppender"/>
    </root>
    </log4j:configuration>
    Does anybody know this problem?

    Try changing "priority" to "level".
    Kevin

  • Cant use log4j or commons logging with ease in OC4J/OAS 10g

    Hi,
    I have a simple JEE 5 app which just uses Log4J for logging. I have a log4j.properties at the right place. But deploying an EAR with this config fails
    Operation failed with error: Lorg/apache/log4j/Logger;
    or if i move to commons logging this...
    Operation failed with error: Lorg/apache/commons/logging/Log;
    Things as simple as using logging, I feel, shouldnt be any complex than what is inferred. Atleast there should more error detailing to it than a bozo message like the above.
    Anyone used logging in just a ejb jar app???

    We've run into this recently and were surprised to find out that Oracle not only "recommends" OAS over OC4J in a production environment, they require it. If you look at the license agreement that you accepted when you downloaded OC4J (you know, the thing that you never read) you'll find that Oracle expressly says that you are not allowed to use OC4J in anything other than a development environment.
    So, after years of using it for several applications, we now have to switch to OAS. Actually, we are doing this not only to stay legal, but also to take advantage of mod_oc4j for reverse proxy. We could not get this to work under OC4J so we started poking around with OAS and then found out that we were not licensed for either in production.
    If you are using OC4J in production, read the not-so-fine print. You are in violation of their license agreement.
    -Bruce Altner
    NASA HQ

  • Very weird issue with server logging when using log4j.properties file

    I'm using log4j logging. In log4j.properties the root logger is set up to use the ServerLoggingAppender class so that all our application logs go to the main server logfile. In addition, there are several appenders defined for specific components, with output going to specific per-component log files. Everything is going fine until I launch the server console. At this point all of those per-component log files get wiped out (zero length) and some non-ASCII lines are written to at least one of these files, after which the logs appear to be fine. The main server log file does not appear to be affected (because the root logger is set to "warn" level, while component-specific loggers are set to trace, the contents in these files is different; however I tried disabling all the other appenders and turning the root logger up to trace, and that still did not re-create the problem in the main server log file.
    And here's the really weird part -- if I use the same configuration, but in a log4j.xml file, the problem does not happen.

    Figured it out.
    We were passing in the configuration for log4j as -Dlog4j.configuration=file:/<properties file> and this was added to the command line for both the managed and admin servers. Problem is that the console app starts its own instance of log4j, and when it reads the configuration for the appenders it initializes or rolls over the files. At some point we have two JVMs accessing the same files, so some corruption is bound to happen.
    I'm not clear why the .xml file made a difference, but earlier we had been passing the log4j configuration as a jar file placed in the domain/lib folder, so perhaps the designer reverted to that (placed the log4j.xml file in a jar in lib, and not simply changed the -Dlog4j.configuration=file:/ option.

  • Using ipad with remote app, I cannot change to watching a movie from listening to music through Apple TV without resetting the procedure. It only changes the song

    Using ipad with remote app, I cannot change to watching a movie from listening to music through Apple TV without resetting the procedure. It only changes the song

    it might be worth checking your TV settings to see if it has an option for different settings based on whether using the tv speakers or headphones.
    Normally you should be able to control the sound via the tv.
    Have you tried it without the headphones?

Maybe you are looking for