YOU WON'T BELIEVE THIS!!!!!!
The XML is posted isn't complete. There was in fact an error. I was
using:-
<appender name="myAppender" class="LoggerAppenderFile">
<layout class="LoggerLayoutSimple" />
</appender>
Seen the mistake????
There is no closing slash after logger.txt - it shoud be:-
In my defence this error also exists in the documentation
http://logging.apache.org/log4php/quickstart.html
There is no closing slash after myLog.log
All works fine now!!!! Knew it would be something simple
£$%^"%^£$%"£$%"£$%"£$%£"$%
krazykev wrote:
>
> Yes - the xml I posted is complete.
>
> Not sure about your link - I am only changing the order of the appenders.
> All apenders still appear before the logger. I should have made that
> clear.
>
> I am still working on this - so far it appears that when parsing the
> FileAppender xml, for some reason the close tag callback is not getting
> executed. Still tracking down why and where.
>
>
> Christian grobmeier wrote:
>>
>>> Your print_r trick stops the php loading.
>>
>> wtf - the xml you posted was complete?
>>
>>> What I have noticed though is that the log4php parser stops parsing
>>> after
>>> the file appender section! So if this appender is last there could be
>>> the 2
>>> stdout out appenders. If its first there won't be any. Still going
>>> through
>>> the log4php code.
>>
>> Yes, please read this issue:
>> https://issues.apache.org/jira/browse/LOG4PHP-101
>> Patches welcome ;-)
>>
>>
>>>
>>>
>>>
>>> Christian grobmeier wrote:
>>>>
>>>>> You are right, the echo statement isn't code good. BUt it works. I
>>>>> have
>>>>> changed it though and it doesn't make a difference.
>>>>
>>>> OK :-)
>>>>
>>>> Yes, you can try:
>>>>
>>>> print_r( Logger::getAllAppenders() );
>>>>
>>>> This should print all configurated appenders. If there is nothing
>>>> returned, we need to look on your xml or on the location of your xml
>>>>
>>>>
>>>>> I am currently going
>>>>> through the log4php code to see if I can spot the problem.
>>>>>
>>>>> Any other ideas?
>>>>>
>>>>>
>>>>> Christian grobmeier wrote:
>>>>>>
>>>>>> Hi
>>>>>>
>>>>>> did you realize you pasted:
>>>>>> echo Hello World;
>>>>>>
>>>>>> while it should be
>>>>>> echo "Hello World";
>>>>>>
>>>>>> Can you check if this is truth?
>>>>>>
>>>>>> Cheers
>>>>>>
>>>>>>
>>>>>> On Mon, Jul 25, 2011 at 5:49 PM, krazykev <[email protected]>
>>>>>> wrote:
>>>>>>>
>>>>>>> Thanks Christian,
>>>>>>>
>>>>>>> nice ideas but no luck. The changes to the config file made no
>>>>>>> difference.
>>>>>>> And the error reporting line doesn't add any errors to stdout (or
>>>>>>> should
>>>>>>> I
>>>>>>> be looking elsewhere)?
>>>>>>> Kev
>>>>>>>
>>>>>>>
>>>>>>> Christian grobmeier wrote:
>>>>>>>>
>>>>>>>> Hey Kev,
>>>>>>>>
>>>>>>>> did you try this:
>>>>>>>>
>>>>>>>> <appender name="myAppender" class="LoggerAppenderFile">
>>>>>>>> <layout class="LoggerLayoutSimple" />
>>>>>>>>
>>>>>>>>
>>>>>>>> </appender>
>>>>>>>>
>>>>>>>> Replace file value with your log location. Maybe its some
>>>>>>>> configuration
>>>>>>>> missing.
>>>>>>>>
>>>>>>>> And you can try to call this in the first line of your script:
>>>>>>>>
>>>>>>>> error_reporting(E_ALL);
>>>>>>>>
>>>>>>>> This should bring up any errors, if any.
>>>>>>>>
>>>>>>>> Let me know what the outcome is
>>>>>>>> Cheers
>>>>>>>> Christian
>>>>>>>>
>>>>>>>> On Mon, Jul 25, 2011 at 1:27 PM, krazykev <[email protected]>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> I hope someone can help me with this - I'm baffled. New to
>>>>>>>>> log4php,
>>>>>>>>> not
>>>>>>>>> new
>>>>>>>>> to log4net or software development/administration.
>>>>>>>>>
>>>>>>>>> I am trying to use log4php to write to a file. My php file is
>>>>>>>>> just
>>>>>>>>> like
>>>>>>>>> the
>>>>>>>>> tutorial.
>>>>>>>>>
>>>>>>>>> <?php
>>>>>>>>> include('src/main/php/Logger.php');
>>>>>>>>> Logger::configure('src/main/php/log4php.xml');
>>>>>>>>> $log = Logger::getLogger('myLogger');
>>>>>>>>>
>>>>>>>>> // Start logging
>>>>>>>>> $log->trace("My first message."); // Not logged because TRACE <
>>>>>>>>> WARN
>>>>>>>>> $log->debug("My second message."); // Not logged because DEBUG <
>>>>>>>>> WARN
>>>>>>>>> $log->info("My third message."); // Not logged because INFO <
>>>>>>>>> WARN
>>>>>>>>> $log->warn("My fourth message."); // Logged because WARN >= WARN
>>>>>>>>> $log->error("My fifth message."); // Logged because ERROR >=
>>>>>>>>> WARN
>>>>>>>>> $log->fatal("My sixth message."); // Logged because FATAL >=
>>>>>>>>> WARN
>>>>>>>>>
>>>>>>>>> echo Hello World;
>>>>>>>>> ?>
>>>>>>>>>
>>>>>>>>> If I use this log4php.xml file, it works perfectly and I get
>>>>>>>>> STDOUT
>>>>>>>>> twice.
>>>>>>>>>
>>>>>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>>>>>> <log4php:configuration
>>>>>>>>> xmlns:log4php="http://logging.apache.org/log4php/">
>>>>>>>>>
>>>>>>>>> <appender name="default" class="LoggerAppenderConsole">
>>>>>>>>>
>>>>>>>>> </appender>
>>>>>>>>>
>>>>>>>>> <appender name="default2" class="LoggerAppenderConsole">
>>>>>>>>>
>>>>>>>>> </appender>
>>>>>>>>>
>>>>>>>>> <root>
>>>>>>>>> <appender_ref ref="default" />
>>>>>>>>> <appender_ref ref="default2" />
>>>>>>>>> </root>
>>>>>>>>> </log4php:configuration>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> BUT.... if I add this
>>>>>>>>>
>>>>>>>>> <appender name="myAppender" class="LoggerAppenderFile">
>>>>>>>>>
>>>>>>>>> </appender>
>>>>>>>>>
>>>>>>>>> I just get "Hello world" on STDOUT. All appenders stop working.
>>>>>>>>> I
>>>>>>>>> have
>>>>>>>>> tried different file paths and have set the file permissions to
>>>>>>>>> full
>>>>>>>>> access
>>>>>>>>> for everyone so I am stumped. How can I see what log4php is
>>>>>>>>> doing?
>>>>>>>>>
>>>>>>>>> I am using PHP 5.3 and IIS 7.
>>>>>>>>>
>>>>>>>>> Any help would be appreciated.
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>>> Kev
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>> http://old.nabble.com/LoggerAppenderFile-on-Windows-tp32130920p32130920.html
>>>>>>>>> Sent from the Log4php - Users mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> http://www.grobmeier.de
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://old.nabble.com/LoggerAppenderFile-on-Windows-tp32130920p32132930.html
>>>>>>> Sent from the Log4php - Users mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> http://www.grobmeier.de
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/LoggerAppenderFile-on-Windows-tp32130920p32133042.html
>>>>> Sent from the Log4php - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> http://www.grobmeier.de
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/LoggerAppenderFile-on-Windows-tp32130920p32133201.html
>>> Sent from the Log4php - Users mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> http://www.grobmeier.de
>>
>>
>
>
--
View this message in context:
http://old.nabble.com/LoggerAppenderFile-on-Windows-tp32130920p32133371.html
Sent from the Log4php - Users mailing list archive at Nabble.com.