Logging exceptions

How can I avoid to log only a particular kind of exception? I tryed to setting "toplink.logging.level" property to SEVERE in persistence.xml. It works but I think it may hide also other kind of exception.

If you use Java logging with TopLink you can configure different logging levels for each logging category.
You could also set logging to severe and then explicitly log just the exceptions you want through SessionLog.logThrowable(SEVERE, error), or potentially use an ExceptionHandler to log certain exceptions as they occur. You could also log the exceptions yourself in your application to your application log, such as using Java logging.
-- James : http://www.eclipselink.org

Similar Messages

  • Log Exceptions on Insert, Erroring on PK Violation

    I have a process that inserts into a table with an append hint. When the insert is based on a select, primary key exceptions propogate to the code and error:
    *1. Create table and error table:*
    SQL>CREATE TABLE test
      2    (col1 NUMBER(10)    CONSTRAINT test_pk01 PRIMARY KEY
      3    );
    Table created.
    SQL>
    SQL>exec dbms_errlog.create_error_log(dml_table_name=>'TEST',err_log_table_name=>'TEST_ERRORS')
    PL/SQL procedure successfully completed.*2. Put a row in:*
    SQL>INSERT INTO test
      2    (col1
      3    )
      4  VALUES
      5    (1
      6    );
    1 row created.*3. Attempt to put rows in that violated the PK with and without append hint:*
    SQL>INSERT INTO test
      2    (col1
      3    )
      4  VALUES
      5    (1
      6    )
      7  LOG ERRORS INTO test_errors
      8  REJECT LIMIT UNLIMITED;
    0 rows created.
    SQL>INSERT /*+ APPEND */ INTO test
      2    (col1
      3    )
      4  VALUES
      5    (1
      6    )
      7  LOG ERRORS INTO test_errors
      8  REJECT LIMIT UNLIMITED;
    0 rows created.
    SQL>SELECT ORA_ERR_MESG$
      2        ,col1 col_1
      3  FROM test_errors;
    ORA_ERR_MESG$                                                          COL_1
    ORA-00001: unique constraint (DW2.TEST_PK01) violated                  1
    ORA-00001: unique constraint (DW2.TEST_PK01) violated                  1So far so good, the code is behaving
    *4. Attempt to Violate the PK with a select in the query (and no append hint):*
    SQL>INSERT INTO test
      2    (col1
      3    )
      4    (select 1 from dual)
      5  LOG ERRORS INTO test_errors
      6  REJECT LIMIT UNLIMITED;
    0 rows created.
    SQL>SELECT ORA_ERR_MESG$
      2        ,col1 col_1
      3  FROM test_errors;
    ORA_ERR_MESG$                                                          COL_1
    ORA-00001: unique constraint (DW2.TEST_PK01) violated                  1
    ORA-00001: unique constraint (DW2.TEST_PK01) violated                  1
    ORA-00001: unique constraint (DW2.TEST_PK01) violated                  1Still OK
    *5. Attempt to violate the PK with a select and an append hint:*
    SQL>INSERT /*+ APPEND */ INTO test
      2    (col1
      3    )
      4    (select 1 from dual)
      5  LOG ERRORS INTO test_errors
      6  REJECT LIMIT UNLIMITED;
    INSERT /*+ APPEND */ INTO test
    ERROR at line 1:
    ORA-00001: unique constraint (DW2.TEST_PK01) violated
    SQL>SELECT ORA_ERR_MESG$
      2        ,col1 col_1
      3  FROM test_errors;
    ORA_ERR_MESG$                                                          COL_1
    ORA-00001: unique constraint (DW2.TEST_PK01) violated                  1
    ORA-00001: unique constraint (DW2.TEST_PK01) violated                  1
    ORA-00001: unique constraint (DW2.TEST_PK01) violated                  1Now I get an error instead of a logged exception
    I've reproduced this on 11.2.0.1.0 & 10.2.0.4.0, both running on windows
    SQL>select * from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - ProductionThe Oracle Knowledge Base is timing out on me at the moment ...
    Thank you for taking the time to have a look.
    Ben

    user503699 wrote:
    bencol wrote:
    The Oracle Knowledge Base is timing out on me at the moment ...
    Thank you for taking the time to have a look.In the case, where you do a "INSERT /*+ APPEND */..VALUES", the hint is ignored as it is not valid (till 10gR2 atleast).
    That statement is executed as conventional INSERT and hence you get error logging. When you do "INSERT /*+ APPEND */...SELECT", oracle attempts to use direct path insert and reports error, ignoring the LOG ERRORS clause, as mentioned in the documentation.11g has introduced an APPEND_VALUES hint to enable direct-path to work with "INSERT INTO...VALUES" syntax.
    What do you get when you use APPEND_VALUES hint, in place of APPEND in your INSERT INTO...VALUES example?

  • How to log Exceptions raised in CAF Application Services

    Hi All,
    When there is an Exception rasing in CAF Application Service custom method implementation what are the steps need to follow for send that exception details to log files & where those log files will be generated i.e either in server, local system, etc.
    If we use following 2 different lines please explain me where that trace is going to written:
    1) System.out.println(e);
    2) e.printStackTrace();
    Thanks in Advance,
    Uday.

    Hi Uday,
    Try this (in my case I'm using that in Background CO that implements IGPBackgroundCallableObject ):
         public static Location logger =
              Location.getLocation(<yourClass>.class);
    Catch block:
              } catch (GPInvocationException e) {
                   throw new GPTechnicalCallableObjectException(
                        logger,
                        resourceAccessor,
                        "ERROR_PARAMETERS",
                        e);
              } catch (GPEngineException e) {
                   throw new GPTechnicalCallableObjectException(
                        logger,
                        resourceAccessor,
                        e.getMessage(),
                        e);
    Reward points if it's helpful.

  • How to log exception from a struts action class

    Hi guys,
    I am recoding my application to use the strut framework. There's one small thing i wonder is that how i can log an exception arrise in an action class. In my original servlet, wherever an exception arise, i use:
    catch(Exception e)
             getServletContext().log("User enter an invalid date");
             throw e;
          }However, when i move this servlet into a action class, the getServletContext method doesnt work anymore. I thought action is a child of httpServlet but since getServletContext is not available in action, then how can i log the error?
    Hope to get some help
    Message was edited by:
    lnthai2002

    Hi guys,
    I am recoding my application to use the strut
    framework. There's one small thing i wonder is that
    how i can log an exception arrise in an action class.
    In my original servlet, wherever an exception arise,
    i use:
    catch(Exception e)
    getServletContext().log("User enter an invalid
    valid date");
             throw e;
          }However, when i move this servlet into a action
    class, the getServletContext method doesnt work
    anymore. I thought action is a child of httpServlet
    but since getServletContext is not available in
    action, then how can i log the error?
    Hope to get some help
    Message was edited by:
    lnthai2002Action class is just a POJO and works a handler of your request. ActionServlet invoke your Action class based on the action you call in your URL. When you are usign the Struts why do you need your Original Servel, use the ActionServlet and if required you can extend it and create your own servlet

  • Log exception 'iView not found: style.css'

    We keep seeing the following exception in our server (EP6 SP2)logs but have no idea what is causing it? Any ideas as to what it relates to and how to fix it?
    Cheers,
    Steve
    [code]Exception ID:02:44_02/08/05_0063
    com.sapportals.portal.prt.runtime.PortalRuntimeException: iView not found: style.css
         at com.sapportals.portal.prt.deployment.DeploymentManager.getPropertyContentProvider(DeploymentManager.java:1701)
         at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.refresh(PortalComponentContextItem.java:193)
         at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.getContext(PortalComponentContextItem.java:287)
         at com.sapportals.portal.prt.component.PortalComponentRequest.getComponentContext(PortalComponentRequest.java:386)
         at com.sapportals.portal.prt.connection.PortalRequest.getRootContext(PortalRequest.java:433)
         at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:536)
         at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:229)
         at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:555)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:415)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.inqmy.services.servlets_jsp.server.InvokerServlet.service(InvokerServlet.java:126)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.inqmy.services.servlets_jsp.server.RunServlet.runSerlvet(RunServlet.java:149)
         at com.inqmy.services.servlets_jsp.server.ServletsAndJspImpl.startServlet(ServletsAndJspImpl.java:833)
         at com.inqmy.services.httpserver.server.RequestAnalizer.checkFilename(RequestAnalizer.java:672)
         at com.inqmy.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:314)
         at com.inqmy.services.httpserver.server.Response.handle(Response.java:173)
         at com.inqmy.services.httpserver.server.HttpServerFrame.request(HttpServerFrame.java:1288)
         at com.inqmy.core.service.context.container.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:36)
         at com.inqmy.core.cluster.impl5.ParserRunner.run(ParserRunner.java:55)
         at com.inqmy.core.thread.impl0.ActionObject.run(ActionObject.java:46)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.inqmy.core.thread.impl0.SingleThread.run(SingleThread.java:148)
    [email protected]59 #[/code]
    Message was edited by: Steve Archer

    Rajendran,
    We're having the same error after upgrading to NW04s, did you figure out the the root cause for this error?
    Thanks,
    Hanh

  • ASA log exception

    Hi,
    How can i except log generation some ip address on ASA.
    I want to filter for generation syslog message for spesific IP address on ASA.
    Thanks.

    yes you can capture for a perticular host and ip
    you have to define access-list for that
    as instance if you want capture icmp logfor the host 192.168.2.115
    then
    first make a access-list
    access-list 101 permit  icmp host 192.168.2.115 any
    then
    you have too attach this access-list with capture commend
    capture (capture name like newcap) newcap access-list 101 interface (interface name like inside,outside,or dmz1) inside
    then the commend is
    capture newcap access-list 101 interface inside
    then if you ping your inside interface then asa will capture this log
    then you can see the log by sh capture (capture name)
    sh capture newcap
    tell us if it is help you

  • Flex preventing ColdFusion server from logging exceptions!

    Hello all,
    Whenever I invoke a CFC from Flex, if the CFC throws an
    exception, that exception is not logged in the ColdFusion server
    logs. I built an html page that invokes the same page, and when the
    exception is thrown it is indeed logged on the server.
    Why is Flex preventing ColdFusion from logging the
    exceptions!?

    I've never realized that but you can add a cflog tag to your
    CFC or debug the error taking a look at the stacktrace withing FB
    debugger.

  • Logging Exception in errorPage of struts

    Hi,
    I have got the code such
    <error-page>
    <error-code>404</error-code>
    <location>/error.jsp</location>
    </error-page>
    which redirects all errors to error.jsp and now in error.jsp I want to get the exact exception message to log(Write) it in a file with log4j.
    could any one help me ?
    Thanks

    Does anyone has an suggestion

  • Logging exception trace

    Hi,
    I am using log4j for logging in my application. How do I log the full exception trace in the problem. the only available method is - log.info(e.getMessage()) which only gives a basic error message, not the trace.
    thanks,
    samit

    Actually, if you look at the [url http://logging.apache.org/log4j/docs/api/org/apache/log4j/Category.html#info(java.lang.Object, java.lang.Throwable)]Log4j API you'll find that there are 2 methods.
    Try this:
    log.info("Some message of your choosing.", e);&#8734; brewman &#8734;

  • How to log exceptions and imp logging info in Portal Service via ILogger?

    Hi Experts,
    I m trying to use ILogger for my application.
    Information about my application:
    I have created a Portal Service and exposed it as a Web Service which is deployed as a PAR file on to the SAP J2EE Engine.
    I need to use the Logging facility of ILogger in this Portal Service.
    I have written the following code in the Init() function of the Portal Service
    public void init(IServiceContext serviceContext)
           mm_logger = serviceContext.getLogger("com.persistent.pankaj");
    I have put the logger.xml in the logger folder of PORTAL-INF
    my logger.xml is as follows:
    <Server>
    <Logger name="testLog" loggerInterface="com.sapportals.portal.prt.logger.ILogger" locationName="com.sap.portal.testLog" pattern="%d # %20t %15s %m #" isActive="true">
    <LoggerClass className="com.sapportals.portal.prt.logger.SimpleFileLogger" level="INFO">
    <param filename="logs/com.persistent.pankaj.log" append="true">
    </param>
    </LoggerClass>
    </Logger>
    </Server>
    On deploying my portal service as a web service
    I m unable to get the logs.
    I even dont know where will i get the log file, means wat is the exact location where i can check my log results
    I m a newbie for this
    Please help me out
    Help will be rewarded n appreciated
    -pankaj

    Hi Pankaj,
    In your init method try this code to create the logger:
    ILogger logger = PortalRuntime.getLogger("testLog");
    In your logger.xml the logger name was testLog and not com.persistent.pankaj so while creating logger you should use testLog in the above code.
    By default all the logs are written to defaultTrace.log files, to check them read this:
    Portal Runtime Logs
    If you want to log in a seperate logfile then you should set a seperate log destination, which is not recommended on productive systems due to performance problems.
    Also read these to know how to set seperate log destinations:
    Netweaver Portal Log Configuration & Viewing (Part 3)
    Netweaver Portal Log Configuration & Viewing (Part 1)
    Netweaver Portal Log Configuration & Viewing (Part 2)
    Regards,
    Praveen Gudapati

  • Log Exception Message in BPM Alert

    Hi all
    I have a problem I am trying to solve. I have searched through the forum to try find pointers to a solution but haven't found anything yet.
    I am trying to process an exception branch in such a way that when it throws an alert, it includes in the alert long text the message from the exception. This means that the person reading the alert will get as much information as possible about the exception that was raised. I can not see how to do this. Is their some way I can "read" the exception, store its contents in a container variable and then add that to the alert message?
    thanks
    malcolm

    You can use the below information for raising an Alert for adapters.
    Specific Error Information from the Adapter Engine:
    Container Element
    ABAP Dictionary Data Type
    Meaning
    SXMS_TO_ADAPTER_TYPE
    CHAR70
    Adapter type
    SXMS_TO_ADAPTER_ERRTXT
    CHAR70
    Error text from the Adapter Engine
    Refer the below link:
    http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm

  • Jvm argument to log exception stack trace?

    I am attempting to debug an application where the developers decided to catch the root exception and throw a generic application exception. Hence the original exception is lost. Is there any arguement that can be passed to the JVM during startup that would tell the JVM's exception handler to write the root exception to standard out?

    You should to fix the application.
    An application may produce exceptions in the normal running of the application. If the application is catching the exception, the JVM would not know which one you didn't want to catch it.
    You could try running the application in a debugger. In many debuggers you can trap on exception. As I my previous point you may need to get through a few irrelevant exceptions.
    Another option is to decompile (e.g. jad) the application main class (one class should be enough) Change it and run with the changed class. You will then see the exception.

  • What is the best practice for logging runtime error  or uncheked exceptions

    hello
    my main problem is logging the nullPointerException to a file
    suppose I have this method
    public void myMethod()
       //..... some declaration here
       User user = obj.findUser("userx"); //this may return null
       System.out.println("user name is "+user.getName()); // I may have a null pointer exception here
    }so what is the best practice to catch the exception ??
    can I log the exception without catching it ???
    thank you

    A terrible way of logging exceptions.Not that im not agreeing with you, but why? (I havent
    actually used this)Because it's always on, for one thing. It's not really configurable either, unless you go to some trouble to make it so. You'd have to provide an InputStream. How? Either at compile-time, which is undesirable, or by providing configuration, which a logging framework has already done, better. Then there's the fact that you can't log anything other than the stacktrace - not particularly helpful a lot of the time. In short, it's a buggy and incomplete solution to something that's already been solved much much better by, for example, Log4J

  • Logging just exceptions and 'critical' TopLink info to the log

    I'm trying to just log exceptions and other 'critical' info that occur within TopLink to the log rather than getting lots of SQL statements, unit of work info etc.
    I'm running TopLink 9.0.3.5 in WebLogic Server 7.0 (SP4) using container managed persistence for Entity Beans.
    If I startup WebLogic with the toplink.log.level=INFO option then I get SQL statements, unit of work info, JTS registration info as well as any exceptions that are logged.
    If I leave the logging like this my WebLogic log will likely be huge and performance degraded from writing a lot of info that will never be used.
    If I startup WebLogic with the toplink.log.level=NONE option then I don't get any log statements, not even exception info (although obviously clients still get the exception stack). I need to get the exceptions and 'critical' TopLink info in the WebLogic log because I cannot rely on getting the information from client logs.
    In the TopLink for WebLogic 2.5.1 product the default logging behaviour was to log only exceptions and other 'critical' info to the log.
    Is there a way to configure TopLink 9.0.3 so that only exceptions and any other 'critical' TopLink information is written to the log (and SQL statements, unit of work info and JTS registration info is not written).
    Thanks.

    You don't mention which version of 10g you have but there is a bug in all versions 10.1.2.0.2 and newer in that usernames are no longer being inserted in the Apache log files when portal pages are viewed. It was somewhat hit or miss before, but good enough to get a feeling of what was being used Now, it does not even provide that. Bug number reference from Metalink is 5638057. It is shown as "Closed -- not feasible to fix", but will be addressed in 11.0
    I am experimenting with getting this data a couple of ways. One, if you happen to use WebTrends, you can manually set the authenticated users field to whatever you'd like so I am using the API's to retrieve the username and the user company (organization) and concatenating them together.
    The other option I am considering is a procedure call in the footer of each page that automatically updates a new table with the session id, username, page, timestamp, and whatever other information you may want each time the page is visited. This table can then be dumped to a data file if desired or left in the database and analyzed using a tool like Discoverer.
    Rgds/Mark M.

  • Logging JDO exceptions

    I find that JBoss hides JDO exceptions which occur on commit. Does
    anyone know how to successfully turn on TRACE level log4j output on
    jboss 3.0.1RC1? Alternatively, is there a way of getting Kodo to log
    exceptions when they are thrown?
    Thanks,
    Tom

    You can catch "unhandled" exceptions as well and do what you want with them.
    Things such as NullPointerException fall under RuntimeException. If you catch that, you can log it as you see fit.
    Is that what you're asking?

Maybe you are looking for

  • Tomcat to Weblogic

    Hi there, I really need help here. Trying to deploy a tomcat web application on Weblogic, and didn't work. What I did: 1, upload the webapp folder of the web application, onto Weblogic / user_projects/ domain / base_domain 2, login into Console, find

  • Upgrade from snow leopard to lion 10.7.2

    Hi all, I wonder if anyone can help me at all. We currently have three MAC computers in our office, the newest one is running on version 10.6.8 and the other two are 10.5.8. I want to upgrade all of them to the new Lion 10.7.2 so we can have the new

  • Data Recovery.....HELP ME!!!!!

    I by accident deleted my movies and tv shows that were on my itunes!!!! I know this isnt the most direst of emergencies, but i do need them back. With the leapard upgrade, how far back can you go with time machine? Will apple help me though this proc

  • Monitor to macbook

    I would like to hook up a Macbook Pro to an older monitor (Apple cinema display ADC, M8058). Is there an adaptor that does this?  Not sure what OS yet. This is what the cable from the monitor looks like: Thanks!

  • The best external HD for FCP use?

    Just looking for some advice on the best ( reliability & value ) external hardrive for using with FCP 6? I have a more Pro tools background and have used Lacie USB drives in the past, but should I be looking at Ext. Firewire drives for editing video?