The array is empty: array(0) { } -----Original Message----- From: Ivan Habunek [mailto:ivan.habu...@gmail.com] Sent: Wednesday, August 17, 2011 3:54 AM To: Log4PHP User Subject: Re: Multiple servers writing to the same file
Please try inserting the following line just after Logger::configure(...) var_dump(Logger::getRootLogger()->getAllAppenders()); It should return something similar to: array(1) { [0]=> object(LoggerAppenderFile)#7 (9) { ["append":"LoggerAppenderFile":private]=> bool(true) ["file":protected]=> string(9) "myLog.log" ["fp":protected]=> resource(23) of type (stream) ["closed":protected]=> bool(false) ["filter":protected]=> NULL ["layout":protected]=> object(LoggerLayoutSimple)#8 (0) { } ["name":protected]=> string(10) "myAppender" ["threshold":protected]=> NULL ["requiresLayout":protected]=> bool(true) } } If not, then the file appender is not being creted at all, and we will have to debug the configurator... Regards, Ivan On 16 August 2011 21:42, Michael Sole <ms...@gold-mobile.com> wrote: > > I checked and it is installed but I knew that as I use it elsewhere. > > > > Here is the feedback from the guys I have working on the issue (besides > myself): > > I found it was reading the config file but if I queried it for current > loggers it had nothing. I tried both stable and trunk versions of log4php > along with several different examples. It is not even trying to open a file > for writing or making any syscalls that are having errors. At this point > someone will dig through the log4php code to try and figure out whats going > on. > > > > > > I added logging to the append function and it wasn't even making it there. > > > > Like I said it works on Ubuntu so there is some weird interaction with Gentoo. > > > > Would suexec affect it in anyway? > > > > From: Ivan Habunek [mailto:ivan.habu...@gmail.com] > Sent: Tuesday, August 16, 2011 3:39 PM > > To: Log4PHP User > Subject: Re: Multiple servers writing to the same file > > > > Possible. Can you run "php -m" and see whether you have the libxml extension > loaded? I think that is the only prerrequisite... > > Ivan > > On 16 August 2011 20:46, Michael Sole <ms...@gold-mobile.com> wrote: > > I think the failure is happening before that point. I doubt the > function is even being called. Even putting in a echo "hi"; nothing shows up. > > Could it be failing on parsing the xml config file? > > -----Original Message----- > From: Ivan Habunek [mailto:ivan.habu...@gmail.com] > > Sent: Tuesday, August 16, 2011 2:31 PM > To: Log4PHP User > Subject: Re: Multiple servers writing to the same file > > Well, I'm really not sure what is wrong here. I haven't tested log4php > on gentoo, but it has been tested on ubuntu and debian. > > If you're feeling adventurous, you can add some var_dumps or such to > the log4php source. The logging is being done in: > /src/main/php/appenders/LoggerAppenderFile.php > > The function is append() on line 109. > > Anything that prevents fopen/flock/fwrite from working would be a > problem. Not that any specific config option comes to mind. > > E.g. try duping what is returned by flock() in line 111. If flock > fails, then the appender will stop logging without reporting an error. > > Unfortunately, there's still a lot of potential silent failures in > log4php source. We're working on improving error reporting. > > Regards, > Ivan > > > On 16.8.2011. 20:21, Michael Sole wrote: > > Yeah I was already trying that: > > <param name="file" > > value="/vdomain/logtest.goldmobile.mobi/html/myLog.log" /> > > <!-- 2 --> > > > > But no dice, its gentoo so there might be some weirdness with it. > > > > I am going to ask my managed host for help and try it on an Ubuntu > > machine. > > > > Any other suggestions would be helpful. > > > > -----Original Message----- > > From: Ivan Habunek [mailto:ivan.habu...@gmail.com] > > Sent: Tuesday, August 16, 2011 2:20 PM > > To: Log4PHP User > > Subject: Re: Multiple servers writing to the same file > > > > That's strange. I just tried it (windows) and it works fine. > > > > Try specifying the full file path, just in case. Something like: > > <param name="file" value="/home/user/myLog.log" /> > > > > Regards, > > Ivan > > > > On 16.8.2011. 20:15, Michael Sole wrote: > >> Thanks. > >> > >> I made the correction but still no luck. The file would be made in > >> the > > > >> same folder as the script that calls it right? > >> > >> I pastebined my code for reference http://pastebin.com/r9XVataM > >> > >> But really I just copied and pasted it. > >> > >> -----Original Message----- > >> From: Ivan Habunek [mailto:ivan.habu...@gmail.com] > >> Sent: Tuesday, August 16, 2011 2:13 PM > >> To: Log4PHP User > >> Subject: Re: Multiple servers writing to the same file > >> > >> No, that's fine. You don't need any PHP extensions to log to files, > >> and it works with the default PHP config. > >> > >> Regards, > >> Ivan > >> > >> On 16.8.2011. 20:05, Michael Sole wrote: > >>> Just an FYI I am running this on Gentoo with PHP 5.3.x > >>> > >>> I have PEAR installed, I am wondering if there are any other PHP > >>> packages or configurations required to make this be able to write > >> files. > >>> > >>> *From:*Ivan Habunek [mailto:ivan.habu...@gmail.com] > >>> *Sent:* Tuesday, August 16, 2011 9:34 AM > >>> *To:* Log4PHP User > >>> *Subject:* Re: Multiple servers writing to the same file > >>> > >>> That should work fine because the file is locked each time before > >>> writing to it (exclusive lock). > >>> > >>> I haven't tested this on a NAS setup, but I have tested it by > >>> having > > >>> two processes log continuously to the same log file on a local > >>> disk and this works ok. > >>> > >>> Let us know if you run into any problems. > >>> > >>> Regards, > >>> Ivan > >>> > >>> On 16 August 2011 15:26, Michael Sole<ms...@gold-mobile.com > >>> <mailto:ms...@gold-mobile.com>> wrote: > >>> > >>> If I were to have a NAS and mount a folder on 2 different servers > >>> to > > >>> a > >> > >>> folder on the NAS could I use log4php to write to the same file > >>> from > > >>> both servers? > >>> > >>> The goal is to have 1 log file from 2 servers in a load balanced > >> array. > >>> > >>> *_______________* > >>> > >>> *Michael F. Sole* > >>> ms...@gold-mobile.com<mailto:ms...@gold-mobile.com> > >>> > >>> Office: 732.632.8801, ext. 261<tel:732.632.8801%2C%20ext.%20261> > >>> Mobile: 516.592.3683<tel:516.592.3683> > >>> > >>> Fax: 732.632.3599<tel: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. > >>> > >> > > > >