Have you considered using the jboss cli instead for changing the logging level?

e.g.
jboss-cli.sh  -c 
'/subsystem=logging/logger=org.apache.http:change-log-level(level=DEBUG)'

This is a runtime change and take effect  immediately.
Tim

________________________________________
From: Tony <cmnewslet...@gmail.com>
Sent: Thursday, 10 September 2015 8:05 a.m.
To: HttpClient User Discussion
Subject: Re: unable to log using log4j for httpclient4.1.3 in JBoss EAP6.0

You are correct.

JBoss is using that bridge, this is the content in commons logging's
module.xml

<module-alias xmlns="urn:jboss:module:1.1"
name="org.apache.commons.logging" target-name="org.slf4j.jcl-over-slf4j"/>

I was able to debug the httpclient code, and see
"org.slf4j.impl.Slf4jLogger" is created, but the handler/appender is always
coming from JBoss's standalone.xml, instead of our own log4j.xml.

On Wed, Sep 9, 2015 at 3:56 PM, Stefan Magnus Landrø <
stefan.lan...@gmail.com> wrote:

> if slf4j works for you, you could bridge commons logging to slf4j to log4j
>
> http://www.slf4j.org/legacy.html
>
> using
>
> jcl-over-slf4j.jar
>
> Right now your app probably uses a commons logging api provided by the
> container
>
> Stefan
>
>
> 2015-09-09 21:49 GMT+02:00 Tony <cmnewslet...@gmail.com>:
>
> > No, we are using slf4j. I know httpclient uses commons logging.
> >
> > Yes, Classloader priority/isolation is the area I'm focusing now.
> >
> > On Wed, Sep 9, 2015 at 3:47 PM, Stefan Magnus Landrø <
> > stefan.lan...@gmail.com> wrote:
> >
> > > 2015-09-09 21:26 GMT+02:00 Tony <cmnewslet...@gmail.com>:
> > >
> > > > With our current config, our own classes can log without any issue.
> > >
> > >
> > > Are you using commons logging in your own classes (i ask since i
> noticed
> > > you have slf4j in your app classpath)
> > >
> > >
> > > > It's
> > > > just not happening for httpclient.
> > > >
> > > > Also, the link is for JBoss AS 4, 5 and 6, ours is JBoss EAP 6, i.e.
> AS
> > > 7.
> > > >
> > >
> > > ok. some of the things probably still apply. Classloader
> > priority/isolation
> > > for instance?
> > >
> > >
> > > >
> > > > On Wed, Sep 9, 2015 at 3:01 PM, Stefan Magnus Landrø <
> > > > stefan.lan...@gmail.com> wrote:
> > > >
> > > > > Have you had a look at these:
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> http://commons.apache.org/proper/commons-logging/guide.html#Configuring_Log4J
> > > > >
> > > > >
> > > >
> > >
> >
> http://www.mastertheboss.com/jboss-server/jboss-log/jboss-log4j-configuration
> > > > >
> > > > > Did you try logging in one of your own classes using commons
> logging
> > > > > instead of slf4j?
> > > > >
> > > > > IMHO the issue you are seeing has nothing to do with http client,
> but
> > > log
> > > > > config on jboss
> > > > >
> > > > > Stefan
> > > > >
> > > > > 2015-09-09 20:43 GMT+02:00 Gary Gregory <garydgreg...@gmail.com>:
> > > > >
> > > > > > There is also the option of using log4j 2 instead of 1 (v1 is
> EOL).
> > > > > >
> > > > > > Gary
> > > > > >
> > > > > > On Wed, Sep 9, 2015 at 4:23 AM, Tony <cmnewslet...@gmail.com>
> > wrote:
> > > > > >
> > > > > > > I think it's more of a combination. I just want to see if
> anyone
> > > has
> > > > > > > similar problem and can shed some light.
> > > > > > >
> > > > > > > On Wed, Sep 9, 2015 at 2:05 AM, Stefan Magnus Landrø <
> > > > > > > stefan.lan...@gmail.com> wrote:
> > > > > > >
> > > > > > > > Isn't this rather a log4j issue?
> > > > > > > >
> > > > > > > > Sendt fra min iPhone
> > > > > > > >
> > > > > > > > > Den 9. sep. 2015 kl. 04.23 skrev Tony <
> > cmnewslet...@gmail.com
> > > >:
> > > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > We are using slf4j&log4j for our web application logging,
> and
> > > we
> > > > > put
> > > > > > > the
> > > > > > > > > log4j.xml file out of our  WAR file so that any changes to
> > the
> > > > > > > log4j.xml
> > > > > > > > > will be read by our scheduler(every 10 min) and take effect
> > > > without
> > > > > > > > > restarting the JBoss server.
> > > > > > > > >
> > > > > > > > > The problem we are having is that even after we put the
> > > > > > > > > <logger name="org.apache.http">
> > > > > > > > >    <level value="DEBUG"/>
> > > > > > > > >  </logger>
> > > > > > > > >
> > > > > > > > > into our log4j.xml, none of the httpclient log is getting
> > > logged
> > > > at
> > > > > > > all.
> > > > > > > > >
> > > > > > > > > It only works when we add the following line into the
> > > > > standalone.xml:
> > > > > > > > >
> > > > > > > > >           <file-handler name="APP_LOG">
> > > > > > > > >                <formatter>
> > > > > > > > >                <pattern-formatter pattern="%d{HH:mm:ss,SSS}
> > > %-5p
> > > > > [%c]
> > > > > > > > (%t)
> > > > > > > > > %s%E%n"/>
> > > > > > > > >                </formatter>
> > > > > > > > >                <file
> > > > path="C:/directoryOutsideJBoss/logs/app.log"/>
> > > > > > > > >                <append value="true"/>
> > > > > > > > >            </file-handler>
> > > > > > > > >            <logger category="org.apache.http">
> > > > > > > > >                <level name="DEBUG"/>
> > > > > > > > >                <handlers>
> > > > > > > > >                    <handler name="APP_LOG"/>
> > > > > > > > >                </handlers>
> > > > > > > > >            </logger>
> > > > > > > > > but this solution is not acceptable since we have to
> restart
> > > the
> > > > > > JBoss
> > > > > > > > > server to have the new logging take effect.
> > > > > > > > >
> > > > > > > > > I did pass the following parameter when starting JBoss:
> > > > > > > > >
> > > > > > > > >
> > > > -Dlog4j.configuration=file:C:\directoryOutsideJBoss\conf\log4j.xml
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > In out WAR/lib directory,  we have:
> > > > > > > > > httpclient-4.1.3.jar
> > > > > > > > > httpcore-4.1.4.jar
> > > > > > > > > log4j-1.2.17.jar
> > > > > > > > > slf4j-api-1.7.2.jar
> > > > > > > > > slf4j-log4j12-1.7.2.jar
> > > > > > > > >
> > > > > > > > > Below is our jboss-deployment-structure.xml
> > > > > > > > >
> > > > > > > > > <jboss-deployment-structure>
> > > > > > > > >  <deployment>
> > > > > > > > >    <exclusions>
> > > > > > > > >      <module name="org.apache.commons.configuration"/>
> > > > > > > > >      <module name="org.apache.log4j" />
> > > > > > > > >      <module name="org.jboss.logging"/>
> > > > > > > > >      <module name="org.slf4j" />
> > > > > > > > >      <module name="org.slf4j.impl" />
> > > > > > > > >      <module name="org.apache.httpcomponents" />
> > > > > > > > >    </exclusions>
> > > > > > > > >    <dependencies>
> > > > > > > > >      <module name ="org.apache.commons.lang"/>
> > > > > > > > >      <module name ="org.apache.commons.beanutils"/>
> > > > > > > > >      <module name ="org.apache.commons.codec"/>
> > > > > > > > >      <module name ="org.apache.commons.io"/>
> > > > > > > > >      <module name ="org.javassist"/>
> > > > > > > > >      <module name ="org.picketbox"/>
> > > > > > > > >      <module name ="javax.ws.rs.api"/>
> > > > > > > > >      <module name="org.dom4j" />
> > > > > > > > >      <module name="org.apache.commons.collections"/>
> > > > > > > > >      <module name="com.google.guava"/>
> > > > > > > > >      <module name="org.apache.cxf" />
> > > > > > > > >      <module name="org.jboss.remote-naming" />
> > > > > > > > >    </dependencies>
> > > > > > > > >  </deployment>
> > > > > > > > > </jboss-deployment-structure>
> > > > > > > > >
> > > > > > > > > BTW, I tried latest HttpClient4.5, same problem.
> > > > > > > > >
> > > > > > > > > Thanks in advance.
> > > > > > > > >
> > > > > > > > > Tony
> > > > > > > >
> > > > > > > >
> > > > ---------------------------------------------------------------------
> > > > > > > > To unsubscribe, e-mail:
> > > httpclient-users-unsubscr...@hc.apache.org
> > > > > > > > For additional commands, e-mail:
> > > > httpclient-users-h...@hc.apache.org
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> > > > > > Java Persistence with Hibernate, Second Edition
> > > > > > <http://www.manning.com/bauer3/>
> > > > > > JUnit in Action, Second Edition <
> http://www.manning.com/tahchiev/>
> > > > > > Spring Batch in Action <http://www.manning.com/templier/>
> > > > > > Blog: http://garygregory.wordpress.com
> > > > > > Home: http://garygregory.com/
> > > > > > Tweet! http://twitter.com/GaryGregory
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > BEKK Open
> > > > > http://open.bekk.no
> > > > >
> > > > > TesTcl - a unit test framework for iRules
> > > > > http://testcl.com
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > BEKK Open
> > > http://open.bekk.no
> > >
> > > TesTcl - a unit test framework for iRules
> > > http://testcl.com
> > >
> >
>
>
>
> --
> BEKK Open
> http://open.bekk.no
>
> TesTcl - a unit test framework for iRules
> http://testcl.com
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org

Reply via email to