From bdw429s at gmail.com Tue Apr 3 17:38:08 2018 From: bdw429s at gmail.com (Brad Wood) Date: Tue, 3 Apr 2018 16:38:08 -0500 Subject: [undertow-dev] Tuckey logging shows in nested categories Message-ID: We're using Undertow in a console app that also leverages Tuckey for URL rewriting. We're also using Log4j for logging stuff. I was noticing this week that most of the log messages from Tuckey seem to be nested inside of a log message from Undertow-- often times with a different logging severity. [INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.Condition TRACE: outcome false I can try and provide the details of how we're using Log4j if I need. I'd like to be able to do some filtering and such to separate out my Tuckey logs, but I can't do it easily when they appear to get caught up and re-logged by Undertow under a different logging category and severity. Any ideas on what's going on would be welcome. Thanks! ~Brad *Developer Advocate* *Ortus Solutions, Corp * E-mail: brad at coldbox.org ColdBox Platform: http://www.coldbox.org Blog: http://www.codersrevolution.com -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20180403/c4c60488/attachment.html From sdouglas at redhat.com Tue Apr 3 19:21:19 2018 From: sdouglas at redhat.com (Stuart Douglas) Date: Wed, 4 Apr 2018 09:21:19 +1000 Subject: [undertow-dev] Tuckey logging shows in nested categories In-Reply-To: References: Message-ID: Tuckey does some funky stuff with logging. It basically has its own thing, that can delegate to slf4j, but if that is not enabled then it will basically end up logging using the ServletContext log() methods (or stderr/stdout). These methods kind of suck, as they have no way to specify a severity or category. In our impl the version without an exception logs at INFO, the version with logs at ERROR. Thinking about it these should really have their own category to make it clear what is going on here. https://github.com/paultuckey/urlrewritefilter/blob/master/src/main/java/org/tuckey/web/filters/urlrewrite/utils/Log.java#L444 Other than adding a slf4j bridge and making it use slf4j somehow I don't know if there is much you can do. Stuart On Wed, Apr 4, 2018 at 7:38 AM, Brad Wood wrote: > We're using Undertow in a console app that also leverages Tuckey for URL > rewriting. We're also using Log4j for logging stuff. I was noticing this > week that most of the log messages from Tuckey seem to be nested inside of > a log message from Undertow-- often times with a different logging > severity. > > [INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.Condition TRACE: outcome false > > I can try and provide the details of how we're using Log4j if I need. I'd > like to be able to do some filtering and such to separate out my Tuckey > logs, but I can't do it easily when they appear to get caught up and > re-logged by Undertow under a different logging category and severity. > > Any ideas on what's going on would be welcome. > > Thanks! > > ~Brad > > *Developer Advocate* > *Ortus Solutions, Corp * > > E-mail: brad at coldbox.org > ColdBox Platform: http://www.coldbox.org > Blog: http://www.codersrevolution.com > > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20180404/9d5b7e0a/attachment.html From bdw429s at gmail.com Tue Apr 3 19:43:14 2018 From: bdw429s at gmail.com (Brad Wood) Date: Tue, 3 Apr 2018 18:43:14 -0500 Subject: [undertow-dev] Tuckey logging shows in nested categories In-Reply-To: References: Message-ID: Wow, good catch. That makes perfect sense. We're already using a custom build of Tuckey that fixes a couple bugs (isn't abandonware great...). We might just see about plugging that log method into Log4j to get proper categories and severities out of it. Thanks for the help! Thanks! ~Brad *Developer Advocate* *Ortus Solutions, Corp * E-mail: brad at coldbox.org ColdBox Platform: http://www.coldbox.org Blog: http://www.codersrevolution.com On Tue, Apr 3, 2018 at 6:21 PM, Stuart Douglas wrote: > Tuckey does some funky stuff with logging. It basically has its own thing, > that can delegate to slf4j, but if that is not enabled then it will > basically end up logging using the ServletContext log() methods (or > stderr/stdout). > > These methods kind of suck, as they have no way to specify a severity or > category. In our impl the version without an exception logs at INFO, the > version with logs at ERROR. Thinking about it these should really have > their own category to make it clear what is going on here. > > https://github.com/paultuckey/urlrewritefilter/blob/master/ > src/main/java/org/tuckey/web/filters/urlrewrite/utils/Log.java#L444 > > Other than adding a slf4j bridge and making it use slf4j somehow I don't > know if there is much you can do. > > Stuart > > On Wed, Apr 4, 2018 at 7:38 AM, Brad Wood wrote: > >> We're using Undertow in a console app that also leverages Tuckey for URL >> rewriting. We're also using Log4j for logging stuff. I was noticing this >> week that most of the log messages from Tuckey seem to be nested inside of >> a log message from Undertow-- often times with a different logging >> severity. >> >> [INFO ] io.undertow.servlet: org.tuckey.web.filters.urlrewrite.Condition TRACE: outcome false >> >> I can try and provide the details of how we're using Log4j if I need. >> I'd like to be able to do some filtering and such to separate out my Tuckey >> logs, but I can't do it easily when they appear to get caught up and >> re-logged by Undertow under a different logging category and severity. >> >> Any ideas on what's going on would be welcome. >> >> Thanks! >> >> ~Brad >> >> *Developer Advocate* >> *Ortus Solutions, Corp * >> >> E-mail: brad at coldbox.org >> ColdBox Platform: http://www.coldbox.org >> Blog: http://www.codersrevolution.com >> >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20180403/304f2212/attachment.html From stevehu at gmail.com Thu Apr 5 05:35:58 2018 From: stevehu at gmail.com (Steve Hu) Date: Thu, 5 Apr 2018 05:35:58 -0400 Subject: [undertow-dev] Cache object that is not thread safe Message-ID: I need to share the same instance of a "Util" object to reuse it in all the handleRequest calls. Where is the best place to store the Util object instance? The Util class is not thread safe, so I should have one instance for each client thread. Thanks, Steve -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20180405/d1890571/attachment-0001.html From sdouglas at redhat.com Thu Apr 5 07:19:42 2018 From: sdouglas at redhat.com (Stuart Douglas) Date: Thu, 05 Apr 2018 11:19:42 +0000 Subject: [undertow-dev] Cache object that is not thread safe In-Reply-To: References: Message-ID: If you want one per thread just use ThreadLocal. Stuart On Thu, 5 Apr. 2018, 7:42 pm Steve Hu, wrote: > I need to share the same instance of a "Util" object to reuse it in all > the handleRequest calls. Where is the best place to store the Util object > instance? The Util class is not thread safe, so I should have one > instance for each client thread. > > Thanks, > > Steve > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20180405/8a75671a/attachment.html From stevehu at gmail.com Thu Apr 5 07:36:35 2018 From: stevehu at gmail.com (Steve Hu) Date: Thu, 5 Apr 2018 07:36:35 -0400 Subject: [undertow-dev] Cache object that is not thread safe In-Reply-To: References: Message-ID: I was thinking about ThreadLocal as it is very popular in Java EE but one request might be handled by multiple threads from IO thread to worker thread which means you have to instantiate as many objects as the number of total threads. Just trying to find if there are any better solutions. Thanks for your confirmation. On Thu, Apr 5, 2018 at 7:19 AM, Stuart Douglas wrote: > If you want one per thread just use ThreadLocal. > > Stuart > > On Thu, 5 Apr. 2018, 7:42 pm Steve Hu, wrote: > >> I need to share the same instance of a "Util" object to reuse it in all >> the handleRequest calls. Where is the best place to store the Util object >> instance? The Util class is not thread safe, so I should have one >> instance for each client thread. >> >> Thanks, >> >> Steve >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20180405/ecfa2c7f/attachment.html From bill at dartalley.com Thu Apr 5 07:50:04 2018 From: bill at dartalley.com (Bill O'Neil) Date: Thu, 5 Apr 2018 07:50:04 -0400 Subject: [undertow-dev] Cache object that is not thread safe In-Reply-To: References: Message-ID: If it's actually a util object can you make it stateless so that it is thread safe? Maybe add an additional context type object for state if you really need it. Attaching it to the exchange as an attachment could work. On Thu, Apr 5, 2018 at 7:36 AM, Steve Hu wrote: > I was thinking about ThreadLocal as it is very popular in Java EE but one > request might be handled by multiple threads from IO thread to worker > thread which means you have to instantiate as many objects as the number of > total threads. Just trying to find if there are any better solutions. > Thanks for your confirmation. > > On Thu, Apr 5, 2018 at 7:19 AM, Stuart Douglas > wrote: > >> If you want one per thread just use ThreadLocal. >> >> Stuart >> >> On Thu, 5 Apr. 2018, 7:42 pm Steve Hu, wrote: >> >>> I need to share the same instance of a "Util" object to reuse it in all >>> the handleRequest calls. Where is the best place to store the Util object >>> instance? The Util class is not thread safe, so I should have one >>> instance for each client thread. >>> >>> Thanks, >>> >>> Steve >>> >>> _______________________________________________ >>> undertow-dev mailing list >>> undertow-dev at lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/undertow-dev >> >> > > _______________________________________________ > undertow-dev mailing list > undertow-dev at lists.jboss.org > https://lists.jboss.org/mailman/listinfo/undertow-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20180405/a2b142ab/attachment.html From stevehu at gmail.com Thu Apr 5 08:21:38 2018 From: stevehu at gmail.com (Steve Hu) Date: Thu, 05 Apr 2018 12:21:38 +0000 Subject: [undertow-dev] Cache object that is not thread safe In-Reply-To: References: Message-ID: Thanks. This is another option to explore. The question was asked on behalf of another user on another forum. I am going to find more info about the use case. Will pass your answers to him. On Thu, Apr 5, 2018, 7:50 AM Bill O'Neil, wrote: > If it's actually a util object can you make it stateless so that it is > thread safe? Maybe add an additional context type object for state if you > really need it. Attaching it to the exchange as an attachment could work. > > On Thu, Apr 5, 2018 at 7:36 AM, Steve Hu wrote: > >> I was thinking about ThreadLocal as it is very popular in Java EE but one >> request might be handled by multiple threads from IO thread to worker >> thread which means you have to instantiate as many objects as the number of >> total threads. Just trying to find if there are any better solutions. >> Thanks for your confirmation. >> >> On Thu, Apr 5, 2018 at 7:19 AM, Stuart Douglas >> wrote: >> >>> If you want one per thread just use ThreadLocal. >>> >>> Stuart >>> >>> On Thu, 5 Apr. 2018, 7:42 pm Steve Hu, wrote: >>> >>>> I need to share the same instance of a "Util" object to reuse it in all >>>> the handleRequest calls. Where is the best place to store the Util object >>>> instance? The Util class is not thread safe, so I should have one >>>> instance for each client thread. >>>> >>>> Thanks, >>>> >>>> Steve >>>> >>>> _______________________________________________ >>>> undertow-dev mailing list >>>> undertow-dev at lists.jboss.org >>>> https://lists.jboss.org/mailman/listinfo/undertow-dev >>> >>> >> >> _______________________________________________ >> undertow-dev mailing list >> undertow-dev at lists.jboss.org >> https://lists.jboss.org/mailman/listinfo/undertow-dev >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.jboss.org/pipermail/undertow-dev/attachments/20180405/0daaa3a9/attachment-0001.html