I'm configuring log4php with xml. Here my configuration:
<appender name="mainAppender" class="LoggerAppenderDailyFile">
<layout class="LoggerLayoutPattern">
<param name="conversionPattern" value="%d{Y-m-d H:i:s.u T P} [%logger] [%level],[%method,%location] %message;%ex%newline" />
</layout>
<param name="file" value=".././logs/main_log-%s.log" />
<param name="datePattern" value="Y-m-d" />
</appender>
<logger name="MainLogger">
<appender_ref ref="mainAppender" />
</logger>
<root>
<level value="TRACE" />
<appender_ref ref="mainAppender" />
</root>
I want the log to be stored always in the same directory, but the above configuration will create the logFile in different place if I call the
Logger::getLogger('MyLogger');
in different location. How can I get the parent directory inside the XML? I was thinking about something like:
<param name="file" value=dirname('/').".././logs/main_log-%s.log" />
That of course is not working. Normally in php to avoid this problem I'm using:
include_once dirname('/').'.././libs/log4php/Logger.php' ;
Thanks for your help