I am using log4php
to log messages in php
. I have the following xml configuration
<configuration xmlns="http://logging.apache.org/log4php/">
<appender name="myAppender" class="LoggerAppenderFile">
<layout class="LoggerLayoutPattern">
<param name="conversionPattern" value="%d{Y-m-d H:i:s} %c %-5p %F %L %m%n" />
</layout>
<param name="file" value="myLog.log" />
</appender>
<root>
<level value="TRACE" />
<appender_ref ref="myAppender" />
</root>
</configuration>
The concerned part is
<param name="conversionPattern" value="%d{Y-m-d H:i:s} %c %-5p %F %L %m%n" />
The %F
is the specifier for getting the file-name. This is logging the message's into the log file. Here is a sample logged message:
2012-09-23 22:15:04 myLog FATAL /media/study/code/live/public_html/log.php 18 My message.
Problem
I want to display only the filename(log.php
in this case) and not the complete path (/media/study/code/live/public_html/log.php
) of the file here. Have searched the Apache docs and SO but couldn't find anything in this reference.
Any hints how to achieve this?