Am 15.05.2012 19:34, schrieb Michael Sole:
We are using log4php quite extensively in our application. We began by
using the XML config file but found that too much of a hassle as we
end up with lots of them. The array method of configuring loggers
seems much more efficient but I am having difficulty converting our
xml file to the array. I am sadly not able to find a good enough
example to use as a template. Can someone please help me by converting
this XML into an array?
<log4php:configuration xmlns:log4php="http://logging.apache.org/log4php/">
<appender name="myAppender" class="LoggerAppenderDailyFile">
<layout class="LoggerLayoutTTCC" />
<param name="datePattern" value="Y-m-d" />
<param name="file"
value="/var/www/virtual/derver.net/michael/htdocs/log/michaeldev%s.log" />
</appender>
<appender name="myAppender" class="LoggerAppenderEcho">
<layout class="LoggerLayoutTTCC" />
</appender>
<root>
<level value="WARN" />
<appender_ref ref="myAppender" />
</root>
</log4php:configuration>
Also, I have had trouble (in the past) with relative paths in the XML,
I assume the array method won't have these issues?
*_______________*
*Michael F. Sole*
ms...@gold-mobile.com
Office: 732.632.8801, ext. 261
Mobile: 516.592.3683
Fax: 732.632.3599
*Gold Mobile*
www.gold-mobile.com <http://www.gold-mobile.com/>**
*Mobile Health Tech Group*
www.mobilehealthtech.md <http://www.mobilehealthtech.md/>
This e-mail and any files transmitted are intended solely for the use
of the individual or entity to whom they are addressed, and for the
use of Gold Mobile. Any other use is strictly prohibited.
Hey Michael,
here's your XML as array:
array(
'appenders' => array(
'myAppender'=>array(
'class'=> 'LoggerAppenderDailyFile',
'layout'=> array(
'class'=>'LoggerLayoutTTCC'
),
'params'=>array(
'datePattern'=>'Y-m-d',
'file'=>'/var/www/virtual/derver.net/michael/htdocs/log/michaeldev%s.log'
)
),
'myAppender'=>array(
'class'=> 'LoggerAppenderEcho',
'layout'=> array(
'class'=>'LoggerLayoutTTCC'
)
)
),
'rootLogger'=> array(
'level'=>'WARN',
'appenders'=>array('myAppender')
)
)
The params-option in the documentation (array as config) is missing.
regards
Florian