>Since it is the first request that triggers the connection opening, I
want to see the debug logs to understand why the connection
establishment failed

I m trying to get the debug logs but I face a problem where debug logs are
always redirected to RootLogger (SLF4j-log4j). How to redirect the debug
logs to logs file other than rootLogger. I have also raised a SO question
with other details like how I tried(
https://stackoverflow.com/questions/58101857/move-jetty-httpclient-debug-logs-from-rootlogger
). Kindly let us know how to handle this case.

My sample is as follows,

private final static Logger logger =  Logger.getRootLogger();

public static void main(String[] args) {
    DailyRollingFileAppender timeAppender = new DailyRollingFileAppender();
    timeAppender.setDatePattern("'.'yyyy-MM-dd-HH-mm");//write at
start of every minute
    timeAppender.setName("FileLogger");
    timeAppender.setFile("/path-to-log/client.log");
    timeAppender.setLayout(new PatternLayout("%t %p %d %-5p [%c{1}] %m%n"));
    timeAppender.setThreshold(Level.ALL);
    timeAppender.setAppend(true);
    timeAppender.activateOptions();
    logger.setAdditivity(false);
    logger.addAppender(timeAppender);

    logger.debug("JDK Used-->"+System.getProperty("java.version"));
    //HttpClient code follows
    ......


and my logger files prints,

main DEBUG 2019-09-25 20:26:07,347 DEBUG [JettyJMX] JDK -->1.8.0_212
main DEBUG 2019-09-25 20:26:07,485 DEBUG [log] Logging to
org.slf4j.impl.Log4jLoggerAdapter(org.eclipse.jetty.util.log) via
org.eclipse.jetty.util.log.Slf4jLog
main INFO 2019-09-25 20:26:07,488 INFO  [log] Logging initialized
@370ms to org.eclipse.jetty.util.log.Slf4jLog
main DEBUG 2019-09-25 20:26:07,591 DEBUG [ContainerLifeCycle]
HttpClient@65e579dc{STOPPED} added
....


But I don't want to use rootLogger as other thirdparty packages may use
slf4j in my application so I want to redirect jetty debug logs to a
separate file. So, instead of using RootLogger I tried using class logger
like

final static Logger logger =  Logger.getLogger(MyClass.class.getName());


which only prints,

main DEBUG 2019-09-25 20:49:03,676 DEBUG [JettyJMX] JDK -->1.8.0_212


SLF4j Jars Used: log4j-1.2.15.jar, slf4j-api-1.7.25.jar,
slf4j-log4j12-1.7.25.jar

Jetty Version Used- 9.4.19

Jdk Used: 1.8

I can get debug logs only if I use rootLogger, is there a way or
configuration to redirect debug logs from RootLogger to any other loggers?

Thanks In Advance




On Mon, Sep 23, 2019 at 11:41 AM Santhosh Kumar <[email protected]>
wrote:

> >What I see from the dump is that the requests get queued and there are
> no established connections.
> Since it is the first request that triggers the connection opening, I
> want to see the debug logs to understand why the connection
> establishment failed, and how it failed (as any failure should have
> aborted the queued requests).
>
> The remote server is always accessible(verified by browser, curl, wget or
> even another jetty standalone program)  when threads are hung.
>
> >You make requests by host or by IP address (i.e. is DNS involved)?
>
> We make requests by IP address.
>
> I ll try to get the debug logs asap
>
> Thanks :)
>
>
>
>
>
> On Fri, Sep 20, 2019 at 7:54 PM Simone Bordet <[email protected]> wrote:
>
>> Hi,
>>
>> On Fri, Sep 20, 2019 at 2:09 PM Santhosh Kumar <[email protected]>
>> wrote:
>> > Enabling Debug logs in production servers are real headache, anyhow I
>> ll try to get the logs somehow. My doubt is *first* request you mean
>> whether its a very first request fired by the client or the first request
>> which hangs?
>>
>> What I see from the dump is that the requests get queued and there are
>> no established connections.
>> Since it is the first request that triggers the connection opening, I
>> want to see the debug logs to understand why the connection
>> establishment failed, and how it failed (as any failure should have
>> aborted the queued requests).
>> You make requests by host or by IP address (i.e. is DNS involved)?
>>
>> --
>> Simone Bordet
>> ----
>> http://cometd.org
>> http://webtide.com
>> Developer advice, training, services and support
>> from the Jetty & CometD experts.
>> _______________________________________________
>> jetty-users mailing list
>> [email protected]
>> To change your delivery options, retrieve your password, or unsubscribe
>> from this list, visit
>> https://www.eclipse.org/mailman/listinfo/jetty-users
>>
>
>
> --
> *With Regards,*
> *Santhosh Kumar J*
>


-- 
*With Regards,*
*Santhosh Kumar J*
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://www.eclipse.org/mailman/listinfo/jetty-users

Reply via email to