I would love to be able to write new semantics for configs or at least propose 
them and I will get working on them right away. As for backwards compatibility 
you could add a new/old flag that would determine the config params type that 
would default to old if not specified.

Logger::configure($logConfig); would use the old
Logger::configure($logConfig,false); would use the old
Logger::configure($logConfig,true); would use the new

The essence of how I would suggest improving this would be able to define a 
logger with a straight list of params, no need to have hierarchical params for 
something as simple as logging.

I was not the only one who had trouble understand how to configure this many 
other people that work for me did as well. We got it working but through lots 
of sweats.



-----Original Message-----
From: Christian Grobmeier [mailto:grobme...@gmail.com] 
Sent: Wednesday, May 16, 2012 1:57 PM
To: Log4PHP User
Subject: Re: Convert to array from XML

Hello Michael,

On Wed, May 16, 2012 at 7:46 PM, Michael Sole <ms...@gold-mobile.com> wrote:
> Thanks!!!!!
>
> Not sure why this isn’t better documented. If multiple arrays didn’t 
> make my eyes bleed I would offer to doc this better. However it seems 
> a more intuitive approach would make more sense. Something like:
>
> Array(‘logger’ => array(‘param’=>’value’, ‘param2’=>’value’));
>
> Or something like that, we don’t need to completely mimic XML, I think

That's right.

You are more than welcome to help us making log4php better. We are a small team 
and appreciate any ideas, help, code patches, docs etc we can get.

As for backwards compatibility I guess we need to stick with what we have now, 
but nothing prevents us to create another configurator which might be enabled 
*somehow* at request.

Cheers
Christian

>
>
>
> From: Florian Semm [mailto:florian.s...@gmx.de]
> Sent: Wednesday, May 16, 2012 1:23 AM
>
>
> To: Log4PHP User
> Subject: Re: Convert to array from XML
>
>
>
> 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
>
> Mobile Health Tech Group
> 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



--
http://www.grobmeier.de
https://www.timeandbill.de

Reply via email to