[MAGNOLIA-2840] Expose server name as a System property so it can be used in log4j messages Created: 12/Aug/09 Updated: 23/Jan/13 Resolved: 12/Aug/09 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | None |
| Affects Version/s: | 4.1 |
| Fix Version/s: | 4.1.1 |
| 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: |
|
||||||||
| 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 |
|
Sometimes is useful to have the server name in log4j log messages. In the default log4j configuration we already use the ${server} variable (snippet from log4j.xml): <param name="ConversionPattern" value="[$\{server}] %-5p %d\{dd.MM.yyyy HH:mm:ss} %c %F(%M:%L) - %m%n" />
<param name="Header" value="%n
===================================%n
Magnolia%n
Version: $\{pom.version}%n
Server: $\{server}%n
Url: %X\{requesturi}%n
Userid: %X\{userid}%n
Number of occurrences: %o%n
===================================%n
" />
"pom.version" is replaced by maven, "requesturi" and "userid" are set by a filter, but "server" needs to be set as a system property in order to work. It's safe to set it since it can't differ also if more webapps are running on the same jvm. |
| Comments |
| Comment by Fabrizio Giustina [ 12/Aug/09 ] |
|
Added in MgnlServletContextListener |
| Comment by Magnolia International [ 11/Jan/11 ] |
|
Couldn't this be already achieved with ${magnolia.servername}, since the log4j file is already "tokenized" with SystemProperty ? |