That is a generic Java topic, and basically you need to add a handler to
the JVM. Something like this;

Thread.setDefaultUncaughtExceptionHandler( new Thread.UncaughtExceptionHandler()
{    public void uncaughtException(Thread t, Throwable e)    {
        log.error( "Uncaught Exception in thread " + t, e );    }});

Of course, you might need to have a bit logic to get hold of a specific
Logger, possibly through reflection.

Niclas

On Tue, Sep 11, 2018 at 3:49 AM, Asma Zinneera Jabir <[email protected]>
wrote:

> I am using pax logging 1.10.1 with Log4J2 as the backend. At the moment,
> the exceptions are only being logged to the console and not to the log file
> unless they are caught. But I want to log the uncaught exceptions also to
> the log file. For example when BundleActivator#*start(BundleContext
> bundleContext) throws Exception* method throws an exception, this should
> be logged to the log file. How can this be done?
>
> Thanks.
>
> --
> --
> ------------------
> OPS4J - http://www.ops4j.org - [email protected]
>
> ---
> You received this message because you are subscribed to the Google Groups
> "OPS4J" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Niclas Hedhman, Software Developer
http://polygene.apache.org - New Energy for Java

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to