

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
3 messages in org.apache.logging.log4j-userPathing question| From | Sent On | Attachments |
|---|---|---|
| Frank Zammetti | Jun 15, 2004 7:21 am | |
| Jacob Kjome | Jun 15, 2004 9:47 pm | |
| Frank Zammetti | Jun 16, 2004 7:17 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Pathing question | Actions... |
|---|---|---|
| From: | Frank Zammetti (fzam...@hotmail.com) | |
| Date: | Jun 15, 2004 7:21:01 am | |
| List: | org.apache.logging.log4j-user | |
Hello all. I'm using Log4J within a Struts-based application running under Tomcat. I configure Log4J when the app starts up within a Struts plug-in via XML file. Here's my config file...
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p %C{2} %x - %m\n" /> </layout> </appender> <appender name="FILE" class="org.apache.log4j.FileAppender"> <param name="Threshold" value="ERROR"/> <param name="File" value="toaerror.log"/> <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p %C{2} %x - %m\n" /> </layout> </appender> <appender name="TOAAGINGFILE" class="org.apache.log4j.FileAppender"> <param name="Threshold" value="DEBUG"/> <param name="File" value="toaAgingError.log"/> <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d %-5p %C{2} %x - %m\n" /> </layout> </appender> <category name="com.mycompany" additivity="true"> <priority value="trace" /> <appender-ref ref="CONSOLE" /> <appender-ref ref="FILE" /> </category> <category name="com.mycompany.toa.daemonthreads.AgingProcessDaemonThread" additivity="true"> <priority value="trace" /> <appender-ref ref="TOAAGINGFILE" /> </category> </log4j:configuration>
Now, this all works fine, so even if you spot something wrong in there, it can probably be ignored for the time being :)
The issue I'm facing is that the log files get created in /tomcat/bin. Previously I had real paths in the config file instead of just the filenames, but we are going to be moving to a new hosting environment, and I am not yet familiar with the directory structures, so I wanted to write this config file in a generic way. But as it is now, there doesn't seem to be any way to tell before-hand where the logs are goingt o wind up being written within a given environment. /tomcat/bin/ isn't the ideal location, clearly.
So, here's my question... how can I specify relative paths in the config file, assmuing I can, and what will it be relative to?
What I'd really like to do is have a /log directory under the /WEB-INF/ directory in my webapp, that would be ideal, or else a /log/ directory in the root of my webapp, but bottom line is that ideally I'd like the logs to be somewhere within my webapp. Is there a way to specify such a location, WITHOUT it being tied to real paths? Even if it's not something in the config file itself, is there some code change I could make to do this, i.e. some sort of Log4J parameter to set before loading the config file? Just guessing here.
My fallback is to re-write the XML on-the-fly from my plug-in, adding the path at runtime before initializing Log4J (I'm assuming I can get that information somehow, but that's another problem!), but I'm really hoping the is a better answer than that.
Thanks in advance everyone!
Frank
_________________________________________________________________ Watch the online reality show Mixed Messages with a friend and enter to win a trip to NY http://www.msnmessenger-download.click-url.com/go/onm00200497ave/direct/01/







