I am new in log4j.I am stuck in log4j log level.My case is that i have created web service server where i print the soap request and response .Although i got the soap ui request and response in trace level ,but my question is that i want to delete all the debug level logs but my request print in trace level which is above the debug level.if i take rootLogger=trace ,then only i see the soap request and response and debug level logs. but if i use other level as rootLogger ,then i could not see trace level logs.I want to remove debug level logs and retain trace level..
My Log4j.properties :
log4j.rootCategory=Trace, stdout
log4j.logger.org.springframework.ws.server.MessageTracing.sent=TRACE
log4j.logger.org.springframework.ws.server.MessageTracing.received=TRACE
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%p [%c{3}] %m%n
LOGS :
DEBUG [javaguys.webservices.UserServiceEndpoints] dafa
DEBUG [method.jaxb.XmlRootElementPayloadMethodProcessor] Marshalling [com.javaguys.webservices.getuserservices.GetUserResponse#39178c5c] to response payload
DEBUG [endpoint.interceptor.PayloadLoggingInterceptor] Response: <ns3:GetUserResponse xmlns:ns3="http://com/javaguys/webservices/getUserServices" xmlns:ns2="http://user.javaguys.blog.com"><ns3:userDetails><ns2:UserId>1</ns2:UserId><ns2:UserName>ashish</ns2:UserName><ns2:UserGender>M</ns2:UserGender><ns2:UserStatus>True</ns2:UserStatus></ns3:userDetails></ns3:GetUserResponse>
DEBUG [endpoint.interceptor.PayloadValidatingInterceptor] Response message validated
TRACE [server.MessageTracing.sent] Sent response [<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns3:GetUserResponse xmlns:ns2="http://user.javaguys.blog.com" xmlns:ns3="http://com/javaguys/webservices/getUserServices"><ns3:userDetails><ns2:UserId>1</ns2:UserId><ns2:UserName>ashish</ns2:UserName><ns2:UserGender>M</ns2:UserGender><ns2:UserStatus>True</ns2:UserStatus></ns3:userDetails></ns3:GetUserResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>] for request [<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://com/javaguys/webservices/getUserServices">
<soapenv:Header/>
<soapenv:Body>
<get:GetUserRequest>
<get:userId>1</get:userId>
</get:GetUserRequest>
</soapenv:Body>
</soapenv:Envelope>]
DEBUG [transport.http.MessageDispatcherServlet] Successfully completed request
Is there any way to remove debug level logs?
Related
My Java Spring Authentication and Authorization Server is working.
I want to solve the errors in the requests I send from a client according to the OAuth2 flow. But none of the errors I get are detailed. For example, this request sent to /oauth2/authorize:
https://MY_DOMAIN/authorize?
response_type=code&
client_id=MY_CLIENT_ID&
redirect_uri=MY_CALLBACK_URL&
scope=SCOPE&
state=STATE
Gives the following error after I enter credentials:
My goal is not to resolve the error here, but there are different errors I get like this and I need to see a more informative error message so I can debug them all.
The console also has a non-informative output that goes like this:
...
2022-08-15 15:52:33.739 DEBUG 50827 --- [nio-9000-exec-4] s.s.w.c.SecurityContextPersistenceFilter : Cleared SecurityContextHolder to complete request
2022-08-15 15:52:33.739 DEBUG 50827 --- [nio-9000-exec-4] o.a.c.c.C.[Tomcat].[localhost] : Processing ErrorPage[errorCode=0, location=/error]
2022-08-15 15:52:33.739 DEBUG 50827 --- [nio-9000-exec-4] o.s.security.web.FilterChainProxy : Securing GET /error?protocol=oauth2&response_type=code&access_type&client_id=articles-client&redirect_uri=http%3A%2F%2F127.0.0.1%3A3000%2Flms%2Flogin&scope=openid%20articles.read&state=XqqDv6wx6O&code_challenge_method=plain&code_challenge=e964fe0c4b609ef3cf29658efc6077e7feb591f78c458c2092aa56c9
...
I want to log in JSON. I have the following log4j.properties:
log4j.rootCategory=ALL,console
log4j.logger.com.demo.package=ALL,console
log4j.additivity.com.demo.package=false
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.out
log4j.appender.console.immediateFlush=true
log4j.appender.console.encoding=UTF-8
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.conversionPattern={"debug_level":"%p","debug_timestamp":"%d{ISO8601}","debug_thread":"%t","debug_file":"%F","debug_line":"%L","debug_message":"%m"}%n
My log statements are like this:
log.error("SocketTimeoutException while fetching log:", e);
But this only logs the message in debug_message key i.e. SocketTimeoutException while fetching log: and the exception stacktrace is logged in a separate line outside the json.
How can I make the exception part of the Pattern.
I triggered CAS Single Sign Out event by visit https://xx/cas-server/logout?service=myservice, and CAS POST a request to myservice(http://test.ogg:8080/cas) with the body:
<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="LR-329-TxwPlscwOydLQH0JD0R2AKmOr4ew5FdiKN2" Version="2.0" IssueInstant="2016-07-15T08:21:38Z"><saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">#NOT_USED#</saml:NameID><samlp:SessionIndex>ST-329-lNWcDWJIW0Ve7ij9gsNG-cas</samlp:SessionIndex></samlp:LogoutRequest>
I have customised logout logic, so used the ticket in <samlp:SessionIndex>ST-329-lNWcDWJIW0Ve7ij9gsNG-cas</samlp:SessionIndex> to call https://xx/cas-server/validateService?service=myservice&ticket=ST-329-lNWcDWJIW0Ve7ij9gsNG-cas, but CAS report ticket invalid:
<cas:serviceResponse xmlns:cas='http://www.yale.edu/tp/cas'>
<cas:authenticationFailure code='INVALID_TICKET'>
Ticket 'ST-329-lNWcDWJIW0Ve7ij9gsNG-cas' not recognized
</cas:authenticationFailure>
Here is the log from CAS server:
2016-07-15 08:21:38,334 DEBUG [org.jasig.cas.logout.SamlCompliantLogoutMessageCreator.create(SamlCompliantLogoutMessageCreator.java:53)] - Generated logout message: [<samlp:LogoutRequest xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" ID="LR-328-qwK2GgGVhRlRtu9QtebIoXIo30iwd4dWWwu" Version="2.0" IssueInstant="2016-07-15T08:21:38Z"><saml:NameID xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">#NOT_USED#</saml:NameID><samlp:SessionIndex>ST-329-lNWcDWJIW0Ve7ij9gsNG-cas</samlp:SessionIndex></samlp:LogoutRequest>]
2016-07-15 08:21:38,334 DEBUG [org.jasig.cas.logout.LogoutManagerImpl.performBackChannelLogout(LogoutManagerImpl.java:143)] - Sending logout request for: [http://test.ogg:8080/cas]
2016-07-15 08:21:38,334 DEBUG [org.jasig.cas.util.SimpleHttpClient$MessageSender.call(SimpleHttpClient.java:297)] - Attempting to access http://test.ogg:8080/cas
2016-07-15 08:21:38,371 DEBUG [org.jasig.cas.web.support.AbstractArgumentExtractor.extractService(AbstractArgumentExtractor.java:45)] - Extractor generated service for: http://test.ogg:8080/cas
2016-07-15 08:21:38,372 DEBUG [org.jasig.cas.ticket.registry.DefaultTicketRegistry.getTicket(DefaultTicketRegistry.java:80)] - Attempting to retrieve ticket [ST-329-lNWcDWJIW0Ve7ij9gsNG-cas]
2016-07-15 08:21:38,372 INFO [org.jasig.cas.CentralAuthenticationServiceImpl.validateServiceTicket(CentralAuthenticationServiceImpl.java:413)] - ServiceTicket [ST-329-lNWcDWJIW0Ve7ij9gsNG-cas] does not exist.
It seems the ticket was expired in 1 second?
When you have logged out, you have logged out. There is nothing further for you to do. Everything is gone. You can't validate something that is destroyed.
I have implemented and deploy Webservice using Axis on Tomcat 6.0, it's working with Java client generated with ADB(Axis2 Databinding Framework), since I need to avoid inner classes in webservice client.
1) I choose the xmlbeans axis client. but it didnt work returns Axisfault unknown
2) tested with SOAPUI and got the following response.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Server</faultcode>
<faultstring>unknown</faultstring>
<detail/>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
checked the following link here and enabled the axis log to TRACE and could not fine anything in the log as error, could anyone help on this ?
Thanks in advance
http://stackoverflow.com/questions/1882398/org-apache-axis2-axisfault-unknown-when-calling-web-service-with-java
following is the part of my detail axis log when request sent from soapUI
6928440022] Invoking flowComplete() for Handler 'SOAPActionBasedDispatcher' in Phase 'Transport'
2015-11-07 20:34:00,094 [http-8082-2] DEBUG org.apache.axis2.engine.Phase - [MessageContext: logID=urn:uuid:5D2DFFEB29EDBF25B4144
6928440022] Invoking flowComplete() for Handler 'RequestURIBasedDispatcher' in Phase 'Transport'
2015-11-07 20:34:00,095 [http-8082-2] DEBUG org.apache.axis2.transport.http.AxisServlet - OnDemandLogger initialized for class or
g.apache.axis2.transport.http.AxisServlet is:org.apache.commons.logging.impl.Log4JLogger#7bfb7cbb
2015-11-07 20:34:00,095 [http-8082-2] DEBUG org.apache.axis2.transport.http.AxisServlet - org.apache.axis2.AxisFault
2015-11-07 20:34:00,096 [http-8082-2] DEBUG org.apache.axis2.addressing.AddressingHelper - [MessageContext: logID=urn:uuid:5D2DFF
EB29EDBF25B41446928440022] isFaultRedirected: FaultTo is null. Returning isReplyRedirected
2015-11-07 20:34:00,098 [http-8082-2] DEBUG org.apache.axis2.addressing.AddressingHelper - [MessageContext: logID=urn:uuid:5D2DFF
EB29EDBF25B41446928440022] isReplyRedirected: ReplyTo is null. Returning false
2015-11-07 20:34:00,098 [http-8082-2] DEBUG org.apache.axis2.context.ConfigurationContext - messageID is null.
2015-11-07 20:34:00,099 [http-8082-2] TRACE org.apache.axis2.addressing.EndpointReference - hasAnonymousAddress: http://www.w3.or
g/2005/08/addressing/anonymous is Anonymous: true
2015-11-07 20:34:00,100 [http-8082-2] TRACE org.apache.axis2.addressing.EndpointReference - hasAnonymousAddress: http://www.w3.or
g/2005/08/addressing/anonymous is Anonymous: true
2015-11-07 20:34:00,107 [http-8082-2] TRACE org.apache.axis2.engine.AxisEngine - [MessageContext: logID=urn:uuid:5D2DFFEB29EDBF25
B41446928440175] sendFault:null
I'm using QuickFIXJ 1.5 version. I set logging level to INFO in my logj.properties file like that:
log4j.logger.quickfixj.msg.incoming=INFO
log4j.logger.quickfixj.msg.outgoing=INFO
log4j.logger.quickfixj.event=INFO
But in the application logs I see DEBUG logs of QuickFIXJ.
27-11-2014 10:20:34.172 8372 [SocketConnectorIoProcessor-0.0] DEBUG (FIXMessageDecoder.java:157) detected header: pos=0,lim=1695,rem=1695,offset=0,state=1
27-11-2014 10:20:34.172 8372 [SocketConnectorIoProcessor-0.0] DEBUG (FIXMessageDecoder.java:176) body length = 1671: pos=0,lim=1695,rem=1695,offset=17,state=3
27-11-2014 10:20:34.172 8372 [SocketConnectorIoProcessor-0.0] DEBUG (FIXMessageDecoder.java:200) message body found: pos=0,lim=1695,rem=1695,offset=1688,state=4
27-11-2014 10:20:34.172 8372 [SocketConnectorIoProcessor-0.0] DEBUG (FIXMessageDecoder.java:207) found checksum: pos=0,lim=1695,rem=1695,offset=1688,state=4
27-11-2014 10:20:34.173 8373 [SocketConnectorIoProcessor-0.0] DEBUG (FIXMessageDecoder.java:226) parsed message: pos=1695,lim=1695,rem=0,offset=1695,state=4
Why does it ignore the level setting in the log4j.properties?
Thanks