How to use log4j in OC4j

Can you give me a sample log4j.xml used for oc4j (orcle 9iAS ). Also
I want to read a env. variable to read the oc4j home in that xml to redirect the log msgs to that folder.Any clue on that ?
(I am developing windows env & deploying solaris. So I cannot use C:\oc4j\.... in my log4j.xml . I need to read the oc4j home from env variable)

This is mine. You cannot read environment variables in the DB JVM using System.getProperty(). One solution may be to configure log properties dynamically using PropertyConfigurator.configure().
log4j.rootLogger=DEBUG, logfile
# Log file appender configuration
log4j.appender.logfile.File=batch.log
log4j.appender.logfile=org.apache.log4j.FileAppender
log4j.appender.logfile.layout=org.apache.log4j.xml.XMLLayout
regards,
Chris

Similar Messages

  • How to use the same OC4j server with different port number

    How to use the same OC4j server with different port numbers..?
    I have to OC4J installed on my machine on different hard disk drives....
    I want to be able to run both the server simultaneously..?
    is it possible ..it yes then how..?
    for that i have changed the port number of one server...
    but when i am trying to start the other server with different port number..it says that JVM -Bind already...
    Is there any clues...?
    Nilesh G

    In the config directory:
    default-web-site.xml: Change the port the HTTP listener listens on
    jms.xml: Change the port the JMS service listens on
    rmi.xml: Change the port the ORMI listener listens on.
    Or, you can add another web-site.xml file, and deploy your applications to 1 server, and bind the web applications to the different web sites. This way you only have to deploy your applications to 1 place.
    Rob
    Oracle

  • How to use JMX with oc4j

    is there any document about how to use JMX with OC4J? the intention is that I would like to create an application, using JMX to manage OC4J, such dynamiclly adding connection pool, create data source. potentially, restart server, application ...
    is there any document about this?
    Thanks

    In addition to that, the documentation also has a section on accessing OC4J JMX/MBeans:
    http://otndnld.oracle.co.jp/document/products/as10g/101300/B25221_03/web.1013/b14433/mbeans.htm#sthref163
    The blog below also has examples, albeit from a Groovy perspective, but nonetheless, examples of how it can be done easily translated into Java:
    http://buttso.blogspot.com/search?q=jmx
    -steve-

  • How to use log4j logging

    Hi all,
    i'm very new to the world of software devlopment.I'm currently working on devloping banking application in JAVA.
    I wanted to log all the exceptions thrown by the code.
    Could any one of you tell me as to how to use log4j logging in my project. Also where to find the jar file. I searched the entire web but i didn't find it anywhere.
    Thanks

    You should find what you need on the Log4j Project Page.

  • How to use log4j into weblogic 10.3

    Hi,
    I am migrating an enterprise application from JBoss 4.3 + JBossCache to WebLogic 10.3+Coherence.
    I am blocked since I can't get log4j to work inside WL.
    I enabled log4j inside the administration console, as stated in the user guide.
    Googling I've also found that I have to copy these 2 jars
    wllog4j.jar
    llog4j-1.2.14.jar
    inside my domain lib directory (that is C:\Oracle\Middleware\user_projects\domains\base_domain\lib), and I did it.
    Now where should I put the log4j.xml configuration file and how can I tell to WL to use that xml as log4j configuration ?
    To give you more information, my classes use log4j in this way:
    Logger log = Logger.getLogger(MyClass.class);
    And I am constantly getting this error:
    log4j:WARN No appenders could be found for logger (it.ltm.ejba.session.EjbAServiceBean).
    log4j:WARN Please initialize the log4j system properly.
    I hope someone can help me.
    I apologize for this stupid question, but really I didn't find a good guide/tutorial on the net.
    Thanks in advance.
    Edited by: e.gherardini on 3-mar-2010 3.16

    Hi Jay, thanks for helping me.
    In fact what I am trying to do is a server-wide log4j configuration.
    Your solution implies writing-deploying-maintaining 1 log4j configuration file for each application developed inside the application server.
    This is not what I want to do.
    Digging around WL 10.3 installation folders, I've found a log4j.properties file inside the medrec example application (C:\Oracle\Middleware\wlserver_10.3\samples\domains\medrec).
    It uses this properties file setting a startup parameter to the server (file setDomainEnv.cmd):
    set JAVA_PROPERTIES=%JAVA_PROPERTIES% -Dlog4j.configuration=file:%LOG4J_CONFIG_FILE%
    I would like to do the same starting the server from eclipse 3.5.
    I am working on this, I hope you can give some hints.
    Thanks a lot

  • How to use log4j in struts project

    Hi, all
    I want to use log4j and pooling in my running project based on struts-tomcat.
    Can any one tell me all the process in details step by step,to apply in my project
    i m wait for any rply

    Another day, another jargon-dump

  • How to use Log4J in EP for log info

    HI Frndz ..
    As per my requirment i have to give a report of all login users log information. In Java we have  Log4J.jar as per miine it is the best API for generating Log information .
    Actualy am trying to place this code and JAR file in com.sap.portal,runtime.logon.par but am not getting any needful output.
    Colud anyonr suggest me how can  we get the Log data usiing Log4J in Portal.
    Thanks in Advance
    Regards
    Rajesh

    Hi Rajesh,
    please check the below link it might be helpful to you.
    Use Class Log4j for logging java application
    Regards
    Narendra

  • How to use log4j in our application

    Hi All,
    I have bit of confused while using the log4j in our java application.
    Please give me the sample code how do we logging our applications?
    Thanks in advance..........

    please give any suggestions........http://logging.apache.org/log4j/docs/documentation.html <- please read.

  • How to use log4j in an EJB Module??

    I have included the log4j.jar in libraries;
    added log4j.xml in the sources folder;
    but I m getting an error:
    <Apr 22, 2014 11:07:50 AM PKT> <Warning> <EJB> <BEA-010065> <MessageDrivenBean threw an Exception in onMessage(). The exception is:
    java.lang.NoClassDefFoundError: org/apache/log4j/Logger.
    java.lang.NoClassDefFoundError: org/apache/log4j/Logger
        at test.MyMessageBean.onMessage(MyMessageBean.java:39)
        at weblogic.ejb.container.internal.MDListener.execute(MDListener.java:575)
        at weblogic.ejb.container.internal.MDListener.transactionalOnMessage(MDListener.java:477)
        at weblogic.ejb.container.internal.MDListener.onMessage(MDListener.java:375)
        at weblogic.jms.client.JMSSession.onMessage(JMSSession.java:4855)
        Truncated. see log file for complete stacktrace
    Kindly guide  me how to resolve this???
    Thank you!

    "I have included the log4j.jar in libraries"  -> what does that actually mean? What steps did you take and where?
    Because one thing is for certain: the jar is not deployed to the proper location so it is on the application's classpath or else you wouldn't be running into this issue.

  • How to use JAXB2 with OC4J 10.1.3??

    Hi,
    It seems that xml.jar (JAXB1) is in the classpath of AS.How can I use JAXB2 with my application??
    Please
    Help
    JO

    OK I found it on my own.
    while deploying using the console
    Unchecked import the oracle.xml library.
    But hown Can I do the same wile using ant ??
    Please advise.
    JO

  • How to use log4j

    Hi All,
    I stucked with the following problem.
    I need to write the log4j for my java application. But i don't know how to write logging's by usubg log4j package.
    Anyone please help me in detail.
    Thanks,
    Kiran

    I got that link . In there i didn't get how to
    procede.
    Please help me...........Gotta read and try it.
    %

  • 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 EJB: where to configure the logging service?

    Hi there,
    I have a question on how to use log4j in EJBs. Details:
    I want to provide a static final Logger instance in each bean class. This logger will be used by my bean instance to log some interesting messages. The log4j service should be initialized (by calling BasicConfigurator.configure() for example) only once before any message is logged. So where should i place the initialization code?
    I know that for a web app, i can define a ServletContextListener implementation to do the initialization work when my web app is loaded. Is there anything similar for EJB?
    Thanks in advance.
    heavyz

    Hi xHacher,
    do you mean something like this?
    public class LogFactory {
        static {
            BasicConfigurator.configure();
        public static Logger getLogger(Class clazz) {
            return Logger.getLogger(clazz);
    }And in each of my bean class, i may get the logger by using:
    private static final Logger log = LogFactory.getLogger(MyBean.class);The code above ensures that log4j is well initialized before any logger instance is created. But any better solutions?
    heavyz

  • How to create the log file in remote system using log4j.

    Hi,
    How to create the log file in remote system using log4j. please give me a sample code or related links.The below example i used for create the log file in remote system but it return the below exception.Is there any authandication parameter for accessing the remote path? Please help.
    public class Logging
    Logger log=null;
    FileAppender fileapp=null;
    public Logging(String classname)
    try
    log = Logger.getLogger(classname);
    String path=" [\\192.168.0.14\\c$\\LOG\\d9\\May_08_2008_log.txt|file://\\192.168.0.14\\c$\\LOG\\d9\\May_08_2008_log.txt]";
    fileapp = new FileAppender(new PatternLayout("%r [%t] %-5p %c %x - %m%n"),path, true);
    log.addAppender(fileapp);
    log.info("Logger initilized");
    }catch(Exception ex)
    ex.printStackTrace();
    java.io.FileNotFoundException: \\192.168.0.14\c$\LOG\d9\May_08_2008_log.txt (The network path was not found)
    at java.io.FileOutputStream.openAppend(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at org.apache.log4j.FileAppender.setFile(FileAppender.java:290)
    at org.apache.log4j.FileAppender.<init>(FileAppender.java:109)
    at annwyn.logger.BioCapLogger.<init>(Logging.java:23)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Please help.
    Thanks in advance.
    Saravanan.K

    Sorry path is missing for the above request.
    path="\\192.168.0.14\c$\LOG\d9\May_08_2008_log.txt ";
    please help.
    Saravanan.K

  • How to Starting and Stopping OC4J Server using Ant

    How to Starting and Stopping OC4J Server using Ant
    In the ant task definitions for ant-oracle-classes.jar (see antlib.xml) there are two tasks called
         name="restartServer" classname="oracle.ant.taskdefs.deploy.JSR88StartServer"
         name="shutdownServer" classname="oracle.ant.taskdefs.deploy.JSR88ShutdownServer"
    I thought that these would shutdown and start the OC4J server. I guessed the parameters as – (Does anyone know where 50 ant targets are documented?)
    <oracle:restartServer
    userid="${oc4j.admin.user}"
         password="${oc4j.admin.password}"
         deployeruri="${deployer.uri}"
    />
    <oracle:shutdownServer
         userid="${oc4j.admin.user}"
         password="${oc4j.admin.password}"
         deployeruri="${deployer.uri}"
    />
    This, however does not start and stop the SOA suite. To do that I've hacked this solution together -
    <path id="oc4j.console">
         <pathelement location="${oracle.home}/config"/>
         <pathelement location="${oracle.home}/jlib/startupconsole.jar"/>
         <pathelement location="${oracle.home}/opmn/lib/optic.jar"/>
         <pathelement location="${oracle.home}/lib/xmlparserv2.jar"/>
    </path>
    <target name="stop" description="stop oc4j server" depends="init">
         <java classname="oracle.appserver.startupconsole.view.Runner">
              <classpath refid="oc4j.console"/>
              <sysproperty key="ORACLE_HOME" path="${oracle.home}"/>
              <arg value="stop"/>
         </java>
    </target>
    <target name="start" description="restart oc4j server" depends="init">
         <java classname="oracle.appserver.startupconsole.view.Runner">
              <classpath refid="oc4j.console"/>
              <sysproperty key="ORACLE_HOME" path="${oracle.home}"/>
              <arg value="start"/>
         </java>
    </target>
    This sort of works – except when the SOA suite doesn't stop cleanly – and needs user interaction to press a Close button. This isn't very useful when doing a continous integration build and deploy.
    So, does anyone have any suggestions or alternative methods to do this?
    - frank

    Actually if the server throws exceptions when it stops (which it always has since we applied patch 10.1.3.3) this technique will pause until a user responds to pop-up ... So a better way (I think) is -
    <target name="start" description="start oc4j server" depends="init">
    <java classname="oracle.appserver.startupconsole.view.Runner">
    <classpath refid="oc4j.console"/>
    <sysproperty key="ORACLE_HOME" path="${oracle.home}"/>
    <arg value="start"/>
    </java>
    </target>
    <target name="stop" description="stop oc4j server" depends="init">
    <echo message="We expect OC4J *NOT* to stop cleanly, so we will timeout after 3 minutes ..."/>
    <java classname="oracle.appserver.startupconsole.view.Runner" fork="true" timeout="180000">
    <classpath refid="oc4j.console"/>
    <sysproperty key="ORACLE_HOME" path="${oracle.home}"/>
    <arg value="stop"/>
    </java>
    </target>
    <target name="restart" description="restart oc4j server">
    <antcall target="stop"/>
    <!-- wait for server to quieten down -->
    <waitfor maxwait="2" maxwaitunit="minute">
    <not><http url="http://${oc4j.http.hostname}:${oc4j.http.port}"/></not>
    </waitfor>
    <antcall target="start"/>
    </target>

Maybe you are looking for

  • How do I disable the remote on my MacBook Pro

    How do I disable the remote on my MacBook Pro, every time I use my remote for my Apple TV iTunes starts playing.

  • Epson scanner 2400 not working with Mac OS X 10.5.8

    I recently upgraded my system to Mac OS X 10.5.8 so that I could use my new iPad/ but now my scanner: Epson performance 2400 is giving me trouble it keeps telling me to restart if I'm using SCSI

  • Delivery Date field in PR/PO needs to be blank

    Hi Experts, At present  system is showing delivery date as todays date , as default. We need this field should be blank , so that user needs to force to enter date in PR/PO creation. Plz give ur ideas how can this be achived. Also can this be done by

  • Get the current count of the client accessing the servlet

    Any body can tell me how to know the information of every client that accessing my servlet after the client access the login interface.

  • Add On Conflict

    Just to make people aware, if you are running SMART Ink Aware on your system, then the Add On in PowerPoint will conflict with Adobe Presenter Add On. If you are running SMART Board software on your system, check your Add On management in PowerPoint