[MAGNOLIA-3201] Additional info added to log4j MDC for easier debugging Created: 13/May/10  Updated: 23/Jan/13  Resolved: 13/May/10

Status: Closed
Project: Magnolia
Component/s: None
Affects Version/s: 4.3.1
Fix Version/s: 4.3.2

Type: Improvement Priority: Trivial
Reporter: Fabrizio Giustina Assignee: Fabrizio Giustina
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
is causing MAGNOLIA-3298 Check for null values for all request... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:

 Description   

ContextFilter actually sets request uri and userid to log4j MDC to simplify debugging, we could add a few more useful items like referral, session id and user agent



 Comments   
Comment by Fabrizio Giustina [ 13/May/10 ]

done for 4.3.2, sample log4j xml file updated

Comment by Jan Haderka [ 13/May/10 ]

Is this really necessary?
When you need such info it can be obtained simply by including SessionDebugger and/or DumpHeadersFilter in the filter chain. Since this is necessary only for debugging I don't think it need to be included by default.

Comment by Fabrizio Giustina [ 13/May/10 ]

well, it's not actually for "debugging": this informations are added to the error logs (usually only for error/fatal level and only in the mail appender when enabled) and are particularly useful for production enviroments.
It's a totally different thing from the DumpsHeadersFilter which have to be enabled explicitly and has a big performance overhead.

This doesn't hurt and doesn't add any performance overhead, so it's nice to have it available as a default...
This is a sample error mail that can be obtained with this filter enabled:

 ===================================
 Mywebsite author
 Version: 1.0.5
 Server: ucz99921
 Url: http://author.website.it/thepage.html
 Referer: http://author.website.it/.magnolia/trees/website.html?mgnlCK=1273572473867
 User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9
 Remote-Host: 195.43.170.198
 Session Id: 72713AD331348DAAF20735B9C7A2A56D.author
 Userid: john
 Number of occurrences: 2
 ===================================

[node1] ERROR 07.05.2010 08:48:38 net.sourceforge.openutils.mgnlcriteria.advanced.impl.QueryExecutorHelper QueryExecutorHelper.java(execute:108) - An error occurred while executing a query. Xpath query was //website//*[( (@jcr:primaryType='mgnl:content')  and  ( jcr:contains(@title, '\(ai\:\)\(n\)\(uk\)') )  )]  order by  @jcr:score descending. Exception message is Exception building query: org.apache.lucene.queryParser.ParseException: Cannot parse '\(ai\:\\)\(n\)\(uk\)': Encountered " ")" ") "" at line 1, column 8.
Was expecting one of:
   <EOF>
   <AND> ...
   <OR> ...
   <NOT> ...
   "+" ...
   "-" ...
   "(" ...
   "*" ...
   "^" ...
   <QUOTED> ...
   <TERM> ...
   <FUZZY_SLOP> ...
   <PREFIXTERM> ...
   <WILDTERM> ...
   "[" ...
   "{" ...
   <NUMBER> ...



===================================

Generated at Mon Feb 12 03:44:10 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.