This discussion is archived
7 Replies Latest reply: Apr 20, 2012 4:24 AM by sbhasin24 RSS

Log4j not working on Weblogic server

sbhasin24 Newbie
Currently Being Moderated
Hi All,

I am using one jar that is using log4j for logging its flow. I have create a java webservice wrapper on the top of that jar.

In standalone envionment when i run class using main all my logs are created in a log file. But when I deploy the same class (webservice) to weblogic server my log file is not created.

I have configure the weblogic server log to Log4j and set the log4j properties file to its class path.

But still I am not able to create a Log file

While configure Log4j for weblogic following error occour on console

<Apr 9, 2012 6:10:57 PM IST> <Notice> <Log Management> <WL-170019> <The server l
og file D:\oracle\Middleware_OSB\user_projects\domains\base_domain\servers\Admin
Server\logs\AdminServer.log is opened. All server side log events will be writte
n to this file.>
<Apr 9, 2012 6:11:05 PM IST> <Notice> <Security> <BEA-090082> <Security initiali
zing using security realm myrealm.>
*<Apr 9, 2012 6:11:09 PM IST> <Notice> <StdErr> <BEA-000000> <java.util.logging.E*
rrorManager: 0: oracle.core.ojdl.weblogic.DomainLogHandler ERROR: unable to find
instance of weblogic.logging.DomainLogBroadcastHandler><Apr 9, 2012 6:11:12 PM IST> <Notice> <WebLogicServer> <WL-000365> <Server state
changed to STANDBY>

One doubt
For application specific log4j do we need to change weblogic default log to log4j? not have much idea on that

Thanks in advance
  • 1. Re: Log4j not working on Weblogic server
    Patrick Taylor Pro
    Currently Being Moderated
    Please refer

  • 2. Re: Log4j not working on Weblogic server
    discharge Newbie
    Currently Being Moderated
    Integration level offered for log4j framework inside weblogic is poor, so it's not worth using weblogic wrappers at all.
    Use plain log4j API instead, and set up logs location at the standard logs forlder of the weblogic instance, here is a confiruration example how I do it:

    log4j.rootLogger=OFF, rolling
    log4j.appender.rolling.layout.ConversionPattern=%d %5p (%c:%L) - %m%n

    Unlike temporary application logs these log files won't be purged or deleted in case you will redeploy or update your application.
  • 3. Re: Log4j not working on Weblogic server
    discharge Newbie
    Currently Being Moderated
    Also, the standard logging setup system does not have options to dynamical set up logging levels & browse app logs via user interface.
    There is a tiny utility which allows you to embed your own log4j debug log browser with dynamic logging levels setup on the fly into application under credentials & URL of your choice.
    See details here:
    The version available at the site does not work with the weblogic, because the author has never tested it there.
    However, with little effort I've adapted it to weblogic, below is a patch file for log4jwebtracker\servlet\ made by WinMerge utility.
    Download sources, apply the patch, then compile & pack log4jwebtracker package into JAR, place it into APP-INF/lib, map log4jwebtracker.servlet.TrackerServlet in WEB-INF/web.xml files as you like and you will have log4j logs level setup & browser in your app straight away, no modification to your app code is required.

    <           String action = request.getRequestURI();
              String action = request.getPathInfo();
    <           if(request.getPathInfo()==null || request.getPathInfo().equals("") || request.getPathInfo().equals("/")) {
              if(request.getPathInfo()==null || (request.getPathInfo()!=null && (request.getPathInfo().equals("") || request.getPathInfo().equals("/")))) {
    synchronized private byte[] getResourcebyURI(String resURI) throws IOException {
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    InputStream in = this.getClass().getResourceAsStream(resURI);
    byte[] b = new byte[4096];
    int n;
    while ((n = != -1) bos.write(b, 0, n);
    return bos.toByteArray();
    <                InputStream in = this.getClass().getResourceAsStream("js/jquery-1.6.4.min.js");
    <                jqueryMin = new byte[in.available()];
    <      ;
    <                in.close();
                   jqueryMin = getResourcebyURI("js/jquery-1.6.4.min.js");
    <           if(jqueryWordWrap==null) {
    <                InputStream in = this.getClass().getResourceAsStream("js/jquery.wordWrap.js");
    <                jqueryWordWrap = new byte[in.available()];
    <      ;
    <                in.close();
              if(jqueryWordWrap==null) {               
                   jqueryWordWrap = getResourcebyURI("js/jquery.wordWrap.js");
    <                InputStream in = this.getClass().getResourceAsStream("css/tracker.css");
    <                css = new byte[in.available()];
    <      ;
    <                in.close();
              css = getResourcebyURI("css/tracker.css");
    <                InputStream in = this.getClass().getResourceAsStream("img/logo.png");
    <                logo = new byte[in.available()];
    <      ;
    <                in.close();
              logo = getResourcebyURI("img/logo.png");
  • 4. Re: Log4j not working on Weblogic server
    sbhasin24 Newbie
    Currently Being Moderated
    Thanks everyone for the help

    But I already configure the weblogic log4j setting

    1) Putting wllog4j.jar and log4j.jar files in the DOMAIN_NAME/lib
    2) Enabled log4j inside the administration console, as stated in the user guide change the default logging to log4j
    3) Set the following properties in startWebLogic.cmd

    set SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% -Dlog4j.configuration=%LOG4J_CONFIG_FILE%

    4) Set the properties in setDomainEnv.cmd
    set JAVA_PROPERTIES=-Dplatform.home=%WL_HOME% -Dwls.home=%WLS_HOME% -Dweblogic.home=%WLS_HOME% -Dweblogic.log.Log4jLoggingEnabled=true

    But when I start the server I get the below error at startup

    <Apr 13, 2012 11:18:34 AM IST> <Notice> <WebLogicServer> <BEA-000365> <Server st
    ate changed to STARTING>
    <Apr 13, 2012 11:18:34 AM IST> <Info> <WorkManager> <BEA-002900> <Initializing s
    elf-tuning thread pool>
    <Apr 13, 2012 11:18:35 AM IST> <Notice> <LoggingService> <BEA-320400> <The log f
    ile D:\oracle\Middleware_OSB\user_projects\domains\base_domain\servers\AdminServ
    er\logs\AdminServer.log will be rotated. Reopen the log file if tailing has stop
    ped. This can happen on some platforms like Windows.>
    <Apr 13, 2012 11:18:35 AM IST> <Notice> <LoggingService> <BEA-320401> <The log f
    ile has been rotated to D:\oracle\Middleware_OSB\user_projects\domains\base_doma
    in\servers\AdminServer\logs\AdminServer.log00049. Log messages will continue to
    be logged in D:\oracle\Middleware_OSB\user_projects\domains\base_domain\servers\
    <Apr 13, 2012 11:18:35 AM IST> <Notice> <Log Management> <WL-170019> <The server
    log file D:\oracle\Middleware_OSB\user_projects\domains\base_domain\servers\Adm
    inServer\logs\AdminServer.log is opened. All server side log events will be writ
    ten to this file.>
    <Apr 13, 2012 11:18:47 AM IST> <Notice> <Security> <BEA-090082> <Security initia
    lizing using security realm myrealm.>
    *<Apr 13, 2012 11:19:15 AM IST> <Notice> <StdErr> <BEA-000000> <java.util.logging*
    *.ErrorManager: 0: oracle.core.ojdl.weblogic.DomainLogHandler ERROR: unable to fi*
    nd instance of weblogic.logging.DomainLogBroadcastHandler><Apr 13, 2012 11:19:21 AM IST> <Notice> <Stdout> <BEA-000000> <<Apr 13, 2012 11:
    19:20 AM IST> <Warning> <> <J2E
    E JMX-46041> <The resource for bundle "oracle.jrf.i18n.MBeanMessageBundle" with
    key "oracle.jrf.JRFServiceMBean.checkIfJRFAppliedOnMutipleTargets" cannot be fou
    <Apr 13, 2012 11:19:22 AM IST> <Notice> <WebLogicServer> <WL-000365> <Server sta
    te changed to STANDBY>
    <Apr 13, 2012 11:19:22 AM IST> <Notice> <WebLogicServer> <WL-000365> <Server sta
    te changed to STARTING>

    Please let me know if I do something wrong while configuration log4j for weblogic as my java web service will not able to read the log4j file and not able to create a log.

    I can't modify any code FOR log4j implementation as I am getting jar from third party and when I call an operation of that jar it internally create a LOG FILE in standalone environment but not in weblogic.
  • 5. Re: Log4j not working on Weblogic server
    sbhasin24 Newbie
    Currently Being Moderated
    Getting below error in weblogic console too. Please provide some pointer

    <Apr 13, 2012 12:25:33 PM IST> <Warning> <Coherence> <BEA-000000> <Oracle Cohere
    nce (member=n/a): Local address "" is a loopback address; this
    cluster node will not connect to nodes located on different machines>
    <Apr 13, 2012 12:25:45 PM IST> <Warning> <WliSbTransports> <BEA-381917> <MQ Tran
    sport could not be registered due to : Missing MQ Library>
    *<Apr 13, 2012 12:25:54 PM IST> <Notice> <StdErr> <BEA-000000> <log4j:WARN No app*
    enders could be found for logger (org.apache.beehive.netui.pageflow.internal.Ada
    *<Apr 13, 2012 12:25:54 PM IST> <Notice> <StdErr> <BEA-000000> <log4j:WARN Please*
    initialize the log4j system properly.>
    *<Apr 13, 2012 12:25:56 PM IST> <Notice> <StdErr> <BEA-000000> <[ERROR] AdapterMa*
    nager - ServletContainerAdapter manager not initialized correctly.>
    *<Apr 13, 2012 12:25:59 PM IST> <Notice> <Stdout> <BEA-000000> <Oracle Service Bu*
    s Debugger listening on port 7453.>
  • 6. Re: Log4j not working on Weblogic server
    Patrick Taylor Pro
    Currently Being Moderated
    <Apr 13, 2012 12:25:54 PM IST> <Notice> <StdErr> <BEA-000000> <log4j:WARN Please initialize the log4j system properly. >
    This is because it is unable to find the file.

    Can you place the file in the DOMAIN_HOME\config folder. This is always in the classpath and should be able to pickup the file.

  • 7. Re: Log4j not working on Weblogic server
    sbhasin24 Newbie
    Currently Being Moderated
    I have put log4j in config file but it does not work. It tried it other folder too but none of the option work.

    Still looking for the solution

    One thing I am using OSB weblogic server.


  • Correct Answers - 10 points
  • Helpful Answers - 5 points