Logger.getAnonymousLogger and log4j

Hi all,
We have developed an application with a combination of our own customized logger class called LogManager (which uses log4j) and java.util.Logger. This application is deployed in tomcat. All the java files have used both these classes for logging messages, a few in the error level and a few in the info level.Something like
private static final LogManager logMgr = new LogManager(PDXDASImpl.class.getName());
Logger.getAnonymousLogger().warning("In PDXDASImpl of "+tdaCurrentInstance+"-Incoming, pdRequest() : Method invoked at  :: "+date.toString());
logMgr.logMessage("INFO", "-----Incoming TDA PDXDasImpl.java pdrequest-------------------------------");But only those the following code
logMgr.logMessage("INFO", "-----Incoming TDA PDXDasImpl.java pdrequest-------------------------------");is logged into the log files which we have mentioned in the log.properties file. Since the application is huge and we dont want to replace the
Logger.getAnonymousLogger().warning("")by
logMgr.logMessage("WARN","");Please suggest some ways to log the messages into the Loggerfile mentioned in the log.properties
Edited by: Kannan_S on Jul 16, 2009 5:26 AM
Edited by: Kannan_S on Jul 16, 2009 5:27 AM

how can I log the traces from DWR into the filesystem of an application instead of SystemOut.log (WebSphere)?First Google result for "dwr logging" is this: [http://directwebremoting.org/dwr/server/servlet/logging]
And it says:
if DWR discovers commons-logging then it will use that in place of servlet logging.So, you need to verify whether [Commons Logging|http://commons.apache.org/logging/] is present in your server, and put it there if it is.
Then you need to determine the logging level of the DWR messages that you care about. It's probably "info" or "debug" rather than "warn".

Similar Messages

  • Jdeveloper, WLS and Log4j logging

    All,
    I want to route all the ADF application log messages to a log file using log4j.
    I have created a log4j.properties and put in the ViewController/src folder. The application finds that config file, and produces the desired output - so far, so good.
    Now I would like to route all the WLS logging using log4j.
    To first try it, I've opened the integrated WLS console, and set, under server/logging, that the log implementation uses log4j instead of jdk. I have also checked the "redirect stdout", "redirect stderr", and "logging bridge" check boxes.
    I've also:
    - included the wllog4j.jar and log4j-1.2.16.jar in the classpath (by editing the /home/semar/Oracle/Middleware/wlserver_10.3/common/bin/commEnv.sh file).
    - put a copy of log4j.properties also in the WLS path - which is, in my case: /home/semar/Oracle/Middleware/wlserver_10.3/server/bin
    - put the path of the log4j.properties in the WLS CLASSPATH (by editing the /home/semar/Oracle/Middleware/wlserver_10.3/common/bin/commEnv.sh file)
    I've then re-started the integrated wls, and now what happens is:
    - the log appender for my application is no more found (log4j complains that the appender is not configured)
    - no log file is produced/updated
    Am I missing something obvious here ? Where should I put the log4j.properties then ? Are other extra tasks I should perform, in order to get all the ADF and WLS logging routed through log4j, and configured using a single log4j property file ?
    I'm using WLS 10.3.5.0 and Jdeveloper 11g rel 2 11.1.2.1.0, running on a Linux OpenSuse 11.4
    Sergio.

    Still no joy.
    I have put the two JARs + log4j.properties into domain_root/lib folder.
    I have also modified the startWeblogic.sh by adding the following:
    JAVA_VM="${JAVA_VM} -Dlog4j.configuration=${DOMAIN_HOME}/lib/log4j.properties"
    export JAVA_VM
    Both the .jar files and the log4j.properties are in the classpath and in the java options of the WLS starting log.
    In my application I have:
    package logging;
    import org.apache.log4j.Logger;
    import...
    public class loggingBean {
    /* Get actual class name to be printed on */
    Logger log = Logger.getLogger(loggingBean.class.getName());
    public loggingBean () {
    System.out.println("hello from loggingBean constructor");
    //_logger.info("Creating a new instance");
    log.debug("Hello this is a debug message");
    log.info("Hello this is an info message");
    In the log4j.properties I have:
    # Define the root logger with appender file
    log = /tmp
    log4j.rootLogger = DEBUG, FILE
    # Define the file appender
    log4j.appender.FILE=org.apache.log4j.FileAppender
    log4j.appender.FILE.File=${log}/log.out
    # Define the layout for file appender
    log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
    log4j.appender.FILE.layout.conversionPattern=%m%n
    # end of the log4j.properties
    And in the standard log file (nohup.out since I start the server with it):
    <11.04.2012 14:56 Uhr MESZ> <Notice> <Stdout> <BEA-000000> <hello from loggingBean constructor>
    <11.04.2012 14:56 Uhr MESZ> <Notice> <StdErr> <BEA-000000> <log4j:WARN No appenders could be found for logger (logging.loggingBean).>
    <11.04.2012 14:56 Uhr MESZ> <Notice> <StdErr> <BEA-000000> <log4j:WARN Please initialize the log4j system properly.>
    <11.04.2012 14:56 Uhr MESZ> <Notice> <StdErr> <BEA-000000> <log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.>
    The file /tmp/log.out does not exist.
    Any thought ?
    Sergio.

  • J2EE and log4j

    I am probably asking to do the impossible ! But I will try anyway !
    We are trying to implement a logging system (with log4j) for an application that executes tasks. The specification is to generate a seperate log file for each task that is executed. We have managed to implement this utilizing the MDC schema of log4j.
    The problem is that the application is comprised of many applications (EAR's) and log4j is only capturing the information logged from the EAR that initialized the log. Is there anyway for log4j to 'track' the transaction through all the EJB's (in different applications) and log the information to the same appender ?
    I know that JMS will resolve this problem but unfortuneatly at this moment we cannot use JMS at this time.
    Thanks in advance for any comments or sugestions !

    >
    Now the next problem is how to create the same logs
    across VM's , ie one EJB calling another remotely and
    the log for the transaction continues in the same
    file.Two different processes? That isn't a good idea. There is no way to synchronize access so it will end overwriting entries.
    You can use a third process which does the actual logging. The other two processes use the appropriate appender to send it to the remote logger.

  • Sun Application Server 8 and Log4j

    In ...\sun\ApplicationServer\domains\domain1\lib\ext, you will find log4j.jar . This, being the extension directory will place log4j.jar high up in the classloader hierarchy.
    Suppose I have a 2 EARs to be deployed, each containing a WAR and a EJB JAR. All use log4j and naturally, each will have either log4j.properties or log4j.xml . Say only file logging is configured and all log to different file each.
    Now the problem: since lib/ext/log4j.jar is always the one to be used, the first log4j.properties or log4j.xml to be used will rule over the rest and all logging across WARs and EJBJARs will be to the SAME file!
    In sun-web.xml, can configure <class-loader> element to not to delegate to parent classloaders (havent tried it). But this does not solve the problem because there seems to be no way to configure likewise for EJBJAR! So even if can place log4j.jar in WEB-INF/lib for WAR and able to log to WAR-specified destinaton file, all the EJBJARs across all EARs will still be using lib/ext/log4j.jar and log to SAME file!
    So I have removed lib/ext/log4j.jar . Am I missing out something here? Any insights?
    Thanks.

    I'm having the same problem....
    But I do not have a log4j.jar file under lib/ext. In fact, that path is empty.
    I posted my issue under a different forum (Java Enterprise System - General Discussion)
    http://forum.java.sun.com/thread.jspa?threadID=5171613
    thread is titled: JES5 and log4j inconsistencies from 2005Q4 with multiple web application
    Any ideas? I'm offering 10 duke dollars for an answer on my original post.

  • How can configure .properties file and  log4j on weblogic 8.1 SP5

    Hi,
    I know this is not right forum for post this question.But I hope I'll get my perfect answer here.
    I have 2 questions.
    1. Where I'll keep my .properties file in weblogic 8.1 SP 5. means I have one own .properties file which is contains some proxy settings and this .properties resides on .war file(now), But I want move this propeties file outside .war file. So Where I'll keep in weblogic 8.1 SP 5.
    2. How can we configure log4j in weblogic?
    Please reply me.
    Regards,
    Pattanaik

    You can add your.properties and log4j.properties to the classpath cant you?
    You just need to edit setEnv.cmd (if i remember correctly) in your weblogic server folder to add the folder containing the properties files to the classpath variable.

  • HT201413 one day i loggged on and all it said was acssecing itunes store but never got there. then a message came up saying "could not connect to itunes server. check your connection and try again later". what should i do?

    one day i loggged on and all it said was acssecing itunes store but never got there. then a message came up saying "could not connect to itunes server. check your connection and try again later". what should i do?

    With those symptoms, I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • OpenPortal Portlet Container and log4j

    Hi,
    I'm trying to get my first portlet to work in OpenPortal Portlet Container 2.0 (on Glassfish) and Eclipse. it works fine, but a couple of things are bugging me. Number one annoyance is that I don't understantd why my log4j logging doesn't work. I found a couple of posts related to this issue, and I configured the log level in the admin page, adding my package with a DEBUG value in the additional properties of the "Module Log Levels" page. Unfortunately, I can't see any log from my portlet in the log file (neither DEBUG nor INFO statements). I only get the container logs.
    I have the log4j.properties file in webContent/config and src/main/resources directories. My web.xml file contains references the properties file
    <context-param>
           <param-name>log4jConfigLocation</param-name>
           <param-value>config/log4j.properties</param-value>
    </context-param>As indicated here on http://www.unicon.net/node/767 , I've checked that commons-logging-1.0.4.jar and log4j-1.2.14.jar are in WEB-INF/lib, as well as log4j.properties is in WEB-INF/classes.
    Any idea ?
    Thanks
    Vincent
    Edited by: VinzFr on Mar 3, 2009 11:45 AM

    Deepak,
    Yes my portlet app is using log4j. I'd like the logs to appear in server.log, or anywhere else. In the log4j.properties file, it is configured to log to c:/portlet.log , but the file isn't even created.
    For the moment, the only solution I have is to use System.out.println :-(
    Regards,
    Vincent

  • Wsa and log4j

    Hi!
    I'm using wsa tool to assemble web-service:
    java -jar %ORACLE_HOME%\webservices\lib\wsa.jar -assemble -appName %appName% -serviceName %serviceName% -interfaceName %interfaceName% -className %className% -input %classes% -output %APP_PATH% -ear %ear% -uri %uri%
    But how should I use it if I need to add Log4J.properties and log4j-1.2.15.jar ?
    Thanks!

    No ideas?

  • Weblogic 10.0 and Log4j classpath problem

    My applications were working fine in WLS 9 but when I upgaded to WLS 10 I started getting log4j configuration and resource finding errors.
    Basically, if I do a "Logger.class.getClassLoader().getResourceAsStream(file)" I get a null pointer excep. bec. the classloader can't find the file that's packed within the EAR.
    Log4j.jar is in my web-inf/lib folder. I also tried putting it in APP-INF/lib to no avail
    Note: In WLS 9.2, there is a log4j jar in BEA_HOME/common/lib and a wllog4j in BEA_HOME/server/lib. So.... it looks like the log4j jar was in the classpath before too. So, not sure what's going on with 10.0
    Any insight into this would be greatly appreciated.
    Edited by mariorod at 05/15/2008 2:47 PM

    Thanks!
    I tried using the same log4j version that WLS10 uses (log4j 1.2.13) and ....... it still didn't work!
    From reading the URL that you stated above, it looks like if log4j 1.2.13 exists in WEB-INF/lib and the WLS modules dir, then WLS will still load the log4j classes from the SYSTEM CP rather than from the web app CP.....
    That seems to explain why even after updating my lib to use the same jar, it still can't find a resource in the web app..
    Is this assumption correct/wrong?
    Any other ideas anyone?
    Edited by mariorod at 05/16/2008 8:33 AM

  • Problem weblogic 9.2 with quartz and log4j : url-template-config.xml

    Hello,
    I configure a Servlet Quartz to run when WebLogic 9.2 starts, but i have an exception, here is my log :
    2009-04-15 11:52:52,424 ERROR Logger.error(): Exception while loading URL templates, /WEB-INF/url-template-config.xml
    Throwable: javax.servlet.ServletException: error: The document is not a url-template-config: document element namespace mismatch expected "" got "http://www.bea.com/servers/weblogic/url-template-config/8.0"
    Stack Trace:
    javax.servlet.ServletException: error: The document is not a url-template-config: document element namespace mismatch expected "" got "http://www.bea.com/servers/weblogic/url-template-config/8.0"
         at org.apache.beehive.netui.core.urltemplates.URLTemplatesFactory.getTemplates(URLTemplatesFactory.java:131)
         at org.apache.beehive.netui.core.urltemplates.URLTemplateDescriptor.load(URLTemplateDescriptor.java:133)
         at org.apache.beehive.netui.pageflow.PageFlowContextListener.performInitializations(PageFlowContextListener.java:102)
         at org.apache.beehive.netui.pageflow.PageFlowActionServlet.init(PageFlowActionServlet.java:120)
         at com.bea.console.internal.ConsoleActionServlet.init(ConsoleActionServlet.java:185)
         at javax.servlet.GenericServlet.init(GenericServlet.java:256)
         at weblogic.servlet.AsyncInitServlet.initDelegate(AsyncInitServlet.java:94)
         at weblogic.servlet.AsyncInitServlet.init(AsyncInitServlet.java:78)
         at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:276)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
         at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:68)
         at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
         at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:48)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:493)
         at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1688)
         at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1665)
         at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1585)
         at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2678)
         at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:874)
         at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:326)
         at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:114)
         at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
         at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:25)
         at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:640)
         at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
         at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:252)
         at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
         at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
         at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:176)
         at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:347)
         at weblogic.management.deploy.internal.DeploymentAdapter$1.activate(DeploymentAdapter.java:50)
         at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
         at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:232)
         at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:168)
         at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:122)
         at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
         at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
         at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
         at weblogic.work.ServerWorkManagerImpl$WorkAdapterImpl.run(ServerWorkManagerImpl.java:518)
         at weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
         at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
    Caused by: org.apache.xmlbeans.XmlException: error: The document is not a url-template-config: document element namespace mismatch expected "" got "http://www.bea.com/servers/weblogic/url-template-config/8.0"
         at org.apache.xmlbeans.impl.store.Locale.verifyDocumentType(Locale.java:449)
         at org.apache.xmlbeans.impl.store.Locale.autoTypeDocument(Locale.java:354)
         at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1270)
         at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1254)
         at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
         at org.apache.beehive.netui.core.urltemplates.schema.UrlTemplateConfigDocument$Factory.parse(Unknown Source)
         at org.apache.beehive.netui.core.urltemplates.DefaultURLTemplateFileParser.parse(DefaultURLTemplateFileParser.java:34)
         at org.apache.beehive.netui.core.urltemplates.URLTemplatesFactory.getTemplates(URLTemplatesFactory.java:118)
         ... 43 more
    The problem may be a conflict with the different version. My versions are quartz-1.6.0.jar, log4j-1.2.15.jar.
    When i rename the file url-template-config.xml i don't have this exception but just a log4j Warning but i don't know if it's not dangerous for my application (run with WebLogic 9.2) if i rename this file.
    Can you give me a solution to remove this exception or tell me if rename this file it's not dangerous ?
    Thank you,
    MH.

    url-template-config.xml is part of Apache Beehive. This file is used to provide a template mechanism for URL's. Is your application using Apache Beehive purposefully?
    http://beehive.apache.org/docs/1.0.2/netui/apidocs/javadoc/org/apache/beehive/netui/core/urls/URLRewriterService.html
    If not, you may have inadvertently added a reference to Apache Beehive when you created the application and now there are references to the Apache Beehive shared libraries in either weblogic-applicaiton.xml or weblogic.xml

  • WLI 2.1 and Log4j

    Has anyone been able to configure log4j (1.2.7) with WLI 2.1? I consistently get
    the following error whenever I try to create a new logger.
    Error:
    java.lang.VerifyError: (class: org/apache/log4j/LogManager, method: <clinit> signature:
    ()V) Incompatible argument to function
    at org.apache.log4j.Logger.getLogger(Logger.java:94)
    I have tried moving the jar file from the webapp classpath to the server classpath,
    but that does not seem to make a difference.
    I am curious if anyone else has seen this error before, and could point me to
    a possible solution.
    Thanks.

    When I place the log4j jar file at the beginning of the server classpath my logging
    works, but the rest of the WLI logging is then broken.
    "Giora Katz-Lichtenstein" <[email protected]> wrote:
    >
    Peter,
    The problem is the wlicommon.jar packages the log4j classes from an earlier
    release.
    To avoid this issue put your log4j-1.2.7.jar before wlicommon.jar in
    the server
    classpath.
    Giora
    "Peter Giesin" <[email protected]> wrote:
    Has anyone been able to configure log4j (1.2.7) with WLI 2.1? I consistently
    get
    the following error whenever I try to create a new logger.
    Error:
    java.lang.VerifyError: (class: org/apache/log4j/LogManager, method:<clinit>
    signature:
    ()V) Incompatible argument to function
    at org.apache.log4j.Logger.getLogger(Logger.java:94)
    I have tried moving the jar file from the webapp classpath to the server
    classpath,
    but that does not seem to make a difference.
    I am curious if anyone else has seen this error before, and could point
    me to
    a possible solution.
    Thanks.

  • Logger DWR with LOG4J.

    Hello,
    After looking at various forums, we want to use Log4J Logger. We added the following line in the properties of log4j:
    log4j.category.uk.ltd.getahead.dwr=warn,my_appender
    log4j.additivity.uk.ltd.getahead.dwr=false
    We should add a parameter for more Logge Log4J with and not in the System.
    Thank you.

    how can I log the traces from DWR into the filesystem of an application instead of SystemOut.log (WebSphere)?First Google result for "dwr logging" is this: [http://directwebremoting.org/dwr/server/servlet/logging]
    And it says:
    if DWR discovers commons-logging then it will use that in place of servlet logging.So, you need to verify whether [Commons Logging|http://commons.apache.org/logging/] is present in your server, and put it there if it is.
    Then you need to determine the logging level of the DWR messages that you care about. It's probably "info" or "debug" rather than "warn".

  • Deployment Problem related to filter, struts and log4j on BEA WLS 8.1 SP4

    Hi to All,
    I have a web application that uses struts 1.1, log4j, axis, filter vs. I have used WLS 8.1 SP4 for 10 months with my application without any problem. But yesterday I can not deploy application, I get the following errors;
    <pre>
    java.lang.NullPointerException
         at weblogic.servlet.internal.WebAppServletContext.destroyFilters(WebAppServletContext.java:6111)
         at weblogic.servlet.internal.WebAppServletContext.destroy(WebAppServletContext.java:5999)
         at weblogic.servlet.internal.ServletContextManager.destroyContext(ServletContextManager.java:196)
         at weblogic.servlet.internal.HttpServer.unloadWebApp(HttpServer.java:777)
         at weblogic.servlet.internal.WebAppModule.destroyContexts(WebAppModule.java:761)
         at weblogic.servlet.internal.WebAppModule.rollback(WebAppModule.java:739)
    </pre>
    I research the exception and get some information; duplicate JAR file on classpath or missing JAR file. But i have another application that have two different log4j jar file, commons logging jar file in its web-inf/lib folder. And this application can be deployed without any problem. When I remove filter definition from web.xml, I get following error;
    <pre>
    - Begin event threw exception
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    Caused by: java.lang.NoClassDefFoundError: org/apache/struts/validator/ValidatorForm
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
         at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
    <Jun 2, 2006 4:28:54 PM EEST> <Error> <HTTP> <BEA-101216> <Servlet: "action" failed to preload on startup in Web application: "deneme".
    javax.servlet.UnavailableException: Parsing error processing resource path
         at org.apache.struts.action.ActionServlet.handleConfigException(ActionServlet.java:1035)
         at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionServlet.java:1014)
         at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet.java:955)
    <Jun 2, 2006 4:28:54 PM EEST> <Error> <HTTP> <BEA-101216> <Servlet: "init" failed to preload on startup in Web application: "deneme".
    javax.servlet.ServletException: org/apache/log4j/Logger
         at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:919)
         at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:883)
         at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:822)
    </pre>
    I can not find a solution, anyone can help me?
    Thanks for answers.
    Message was edited by:
    mucahitkurt

    Hi,
    It seems to be some of the files did not sign in the jar that may be cause for this type of error.
    Make sure that whether all files were signed or not in jar.
    Regards
    Anilkumar kari

  • MDB Container Managed Transaction and Log4J

    Hi,
    I'm programming and MDB that reads and updates a database then sends out an HTTP Post and logs using log4j. I've read that when an MDB is configured as CMT or container managed transaction and the OnMessage method executes without errors, the transaction is implicitly commited. You can rollback the transaction by explicitly calling setRollbackOnly() or when a RuntimeException has been thrown. My worry is that after I have sent out an HTTP POST (a transaction has been completed) I would have to log a transaction completion using log4j. My problems is if log4j throws a RuntimeException thereby rolling back my transaction which shouldn't be the case. What I have done is to catch all Exceptions (and swallow them) whenever I log using log4j after I have sent out an HTTP POST succesfully (since my transaction should be complete by then). Is this a correct workaround?
    Thanks :)

    Your approach is correct. If you think, Log4J might throw errors, swallow the exceptions and try not to roll back.

  • .jar not working when building project with netbeans plugin and log4j

    hey..
    subject tells everything..if i build my project referencing log4j, i get a .jar file with 280 kb which is executable
    if i add log4j and do some logging, code still works in netbeans, but buildung produces a .jar with 80 kb and an
    attached lib-folder with the log4j.jar in it..if i uncheck copy requested libraries, i just get the 80 kb .jar file which
    is not working
    any hints?

    Are you building the jar file using the fxdeploy ant task to build the Jar? That is required to have an executable jar file.
    Also there was a change to the netbeans project structure, which may be a contributing factor.
    Things to try: Upgrade to the latest netbeans 7.1 beta build, set up a new Java platform in nb that includes JavaFX, create a new JavaFX project and build it. This should produce an executable jar.

Maybe you are looking for