RE: Error while starting second instance of application
Hi, Do you think maybe that you should only use one instance of your application? Or try and generate a random named file that feeds a general log file on exit? You are probably getting this as you are specifying the same filename for each instance in either your code or you .config. Have a think about what it is you are actually trying to do right now. K From: vikas manghani [mailto:vikas.mangh...@datamatics.com] Sent: 22 November 2010 13:14 To: log4net-user@logging.apache.org Subject: Error while starting second instance of application Hi I am using log4net in my Windows CE application. I am getting the following error when I try to run a second instance of my application on the device: Unable to acquire lock on file File Path. The process cannot access the file File Path because it is being used by another process. Its clear that log4net is unable to lock the log files when the second instance is started. The problem is that, this opens up in a notepad window and then stays there till the second instance ends. I want to prevent this error from being displayed to the user as I am showing an informational message to indicate that only one instance of the application can be started. Kindly let me know what can be done here to prevent the log4net error popping up in Notepad. Thanks and regards Vikas Manghani Disclaimer: The information contained in this e-mail and attachments if any are privileged and confidential and are intended for the individual(s) or entity(ies) named in this e-mail. If the reader or recipient is not the intended recipient, or employee or agent responsible for delivering to the intended recipient, you are hereby notified that dissemination, distribution or copying of this communication or attachments thereof is strictly prohibited. IF YOU RECEIVE this communication in error, please immediately notify the sender and return the original message.
RE: Error while starting second instance of application
I am sorry, but this doesn't seem to make sense to me. Are you suggesting that you would like a logging mechanism to log errors generated by log4net? If that is the case, are you sure you haven't over-engineered your application? What Robert is suggesting is sound, simply have the logfile open when you are logging and then lose the lock after this has taken place. From: vikas manghani [mailto:vikas.mangh...@datamatics.com] Sent: 22 November 2010 15:16 To: Log4NET User Subject: Re: Error while starting second instance of application Hi Robert Thanks, but the logging mechanism of our application is based on a wrapper over the core log4net libraries. I wouldnt be able to delay the configuring the logging. Instead if it would be possible to suppress the error popping up in notepad or better yet to redirect the error to a log file without it being displayed to the user, it would be great. Thanks and regards Vikas Manghani - Original Message - From: Robert Prouse mailto:r...@prouse.org To: 'Log4NET User' mailto:log4net-user@logging.apache.org Sent: Monday, November 22, 2010 7:31 PM Subject: RE: Error while starting second instance of application If the second instance of your app is just displaying a message and then shutting down, why don't you delay configuring logging until after you have done your instance checks? Do this by calling XmlConfigurator.Configure instead of using the assembly attribute to configure logging. Rob Prouse From: Karim Bourouba [mailto:kar...@hotmail.com] Sent: November-22-10 8:30 AM To: 'Log4NET User'; 'vikas manghani' Subject: RE: Error while starting second instance of application Hi, Do you think maybe that you should only use one instance of your application? Or try and generate a random named file that feeds a general log file on exit? You are probably getting this as you are specifying the same filename for each instance in either your code or you .config. Have a think about what it is you are actually trying to do right now. K From: vikas manghani [mailto:vikas.mangh...@datamatics.com] Sent: 22 November 2010 13:14 To: log4net-user@logging.apache.org Subject: Error while starting second instance of application Hi I am using log4net in my Windows CE application. I am getting the following error when I try to run a second instance of my application on the device: Unable to acquire lock on file File Path. The process cannot access the file File Path because it is being used by another process. Its clear that log4net is unable to lock the log files when the second instance is started. The problem is that, this opens up in a notepad window and then stays there till the second instance ends. I want to prevent this error from being displayed to the user as I am showing an informational message to indicate that only one instance of the application can be started. Kindly let me know what can be done here to prevent the log4net error popping up in Notepad. Thanks and regards Vikas Manghani Disclaimer: The information contained in this e-mail and attachments if any are privileged and confidential and are intended for the individual(s) or entity(ies) named in this e-mail. If the reader or recipient is not the intended recipient, or employee or agent responsible for delivering to the intended recipient, you are hereby notified that dissemination, distribution or copying of this communication or attachments thereof is strictly prohibited. IF YOU RECEIVE this communication in error, please immediately notify the sender and return the original message. Disclaimer: The information contained in this e-mail and attachments if any are privileged and confidential and are intended for the individual(s) or entity(ies) named in this e-mail. If the reader or recipient is not the intended recipient, or employee or agent responsible for delivering to the intended recipient, you are hereby notified that dissemination, distribution or copying of this communication or attachments thereof is strictly prohibited. IF YOU RECEIVE this communication in error, please immediately notify the sender and return the original message.
RE: Problem in mixed .net 4.0 and 2.0 project
Are you building the Log4Net binaries under .Net 4.0 prior to using them in your project? From: Marc Gerritsen [mailto:marc.gerrit...@topicus.nl] Sent: 30 August 2010 14:25 To: log4net-user@logging.apache.org Subject: Problem in mixed .net 4.0 and 2.0 project Hello, We are building an application that makes use of log4net It also uses Spring.Net and NHibernate. When we upgraded our solution from VS 2008 to VS 2010 we got a problem. We changed the framework of all the projects to the full .net 4.0 framework. But we use some components we created our self and use them in many more projects. These projects are in framework 3.5 and can't be upgraded just yet. The problem is that when there is an exception triggered from a 3.5 component and catch it in a 4.0 project to log we get the following exception: log4net.ErrorException rendering object type [Force.Workflow.Core.Exceptions.WorkflowIllegalStatusChange]stackTraceSyst em.BadImageFormatException: The parameters and the signature of the method don't match. at System.Reflection.RuntimeParameterInfo.GetParameters(IRuntimeMethodInfo methodHandle, MemberInfo member, Signature sig, ParameterInfo returnParameter, Boolean fetchReturnParameter) at System.Reflection.RuntimeMethodInfo.GetParameters() at System.Diagnostics.StackTrace.ToString(TraceFormat traceFormat) at System.Exception.GetStackTrace(Boolean needFileInfo) at System.Exception.ToString(Boolean needFileLineInfo) at log4net.ObjectRenderer.DefaultRenderer.RenderObject(RendererMap rendererMap, Object obj, TextWriter writer) at log4net.ObjectRenderer.RendererMap.FindAndRender(Object obj, TextWriter writer)/stackTrace/log4net.Error Does anyone have a clue how this is possible? An how we could fix it? Cheers, Marc Gerritsen
RE: webapplication logging - one log file per user
Hi Raj, surely there wouldnt be a new log created for each user interaction? Wouldnt it be better for you to just record each interaction on one log? Date: Sat, 28 Nov 2009 19:03:24 +0530 Subject: Re: webapplication logging - one log file per user From: shivaraj...@gmail.com To: log4net-user@logging.apache.org Thanks Karim. I don't have any other logging. There is only one type of logging - log all the errors per user in a log whose name would be the person who logged in. If 10 users are goign to use the application 10 seperate logs should be there. Help me out. Regards, Raj. On Sat, Nov 28, 2009 at 4:31 PM, Karim Bourouba kar...@hotmail.com wrote: Does your web app already store this information in a seperate log, or at a different level? If it does, it may be easy to create a new appender to get the information out of this source rather than shoehorning it all into log4net. Date: Sat, 28 Nov 2009 10:16:44 +0530 Subject: webapplication logging - one log file per user From: shivaraj...@gmail.com To: log4net-user@logging.apache.org Hi, Please help me with this query in using log4net. I am using log4net in mhy we application. I am facing issues in configuring log4net to log errors at user level. That is, If user X logs in, I like to create file name X and all error for user X should be written in X.log. Siilarly if Y user logs in the log file should be in name of Y.log and the most important point to note is, they could log in concurrently. I tried the luck by creating log files whose name would be framed dynamically as soon as the user logs in. But issue here, if they are not using the application at the same time, the log files are creeated with correct name and writing as expected, but if both users have active sessions, log file is created only for user who FIRST logged in and error of second user has been recorded in log file that is created for FIRST user. Please help me in this. Thanks much. Use Hotmail to send and receive mail from your different email accounts. Find out how. _ Got more than one Hotmail account? Save time by linking them together http://clk.atdmt.com/UKM/go/186394591/direct/01/
RE: Signing the log4net.dll with a digital signature
I would say yes, it is. But I am not sure as to why you would want to do this? From: m.habl...@tricentis.com To: log4net-user@logging.apache.org Date: Mon, 12 Oct 2009 13:06:34 +0200 Subject: Signing the log4net.dll with a digital signature Hello, is it allowed to sign the log4net.dll with my own digital signature? Thanks in advance, Michael _ View your other email accounts from your Hotmail inbox. Add them now. http://clk.atdmt.com/UKM/go/167688463/direct/01/
RE: AW: Signing the log4net.dll with a digital signature
Of course, this makes sense to me now. From: m.habl...@tricentis.com To: log4net-user@logging.apache.org Date: Mon, 12 Oct 2009 13:57:54 +0200 Subject: AW: Signing the log4net.dll with a digital signature One prerequisite for Windows certification (for the software) is having all deployed DLLs digitally signed wheter from the original developer or the deployer. Von: Karim Bourouba [mailto:kar...@hotmail.com] Gesendet: Montag, 12. Oktober 2009 13:51 An: log4net-user@logging.apache.org Betreff: RE: Signing the log4net.dll with a digital signature I would say yes, it is. But I am not sure as to why you would want to do this? From: m.habl...@tricentis.com To: log4net-user@logging.apache.org Date: Mon, 12 Oct 2009 13:06:34 +0200 Subject: Signing the log4net.dll with a digital signature Hello, is it allowed to sign the log4net.dll with my own digital signature? Thanks in advance, Michael View your other email accounts from your Hotmail inbox. Add them now. _ Learn how to add other email accounts to Hotmail in 3 easy steps. http://clk.atdmt.com/UKM/go/167688463/direct/01/
RE: timstamped logs
Hi John, are the file sizes of the log files you are generating larger than 5mb at all? From: john.fairh...@quest.com To: log4net-user@logging.apache.org Date: Tue, 29 Sep 2009 20:05:03 -0700 Subject: timstamped logs I have an app using log4net with logging set as follows: log4net appender name=RollingFile type=log4net.Appender.RollingFileAppender file value=..\log\OOPCollector.log / appendToFile value=false / maximumFileSize value=5MB / maxSizeRollBackups value=5 / lockingModel type=log4net.Appender.FileAppender+MinimalLock / layout type=log4net.Layout.PatternLayout conversionPattern value=%date %5level [%thread] %logger - %message%newline / /layout /appender /log4net The app generally generates these logs; OOPCollector.log OOPCollector.log.1 OOPCollector.log.2 OOPCollector.log.3 OOPCollector.log.4 OOPCollector.log.5 But sometimes we see logs with a timestamp, such as OOPCollector.log.2009-09-18 OOPCollector.log.2009-09-18.1 OOPCollector.log.2009-09-18.2 OOPCollector.log.2009-09-18.3 OOPCollector.log.2009-09-18.4 OOPCollector.log.2009-09-18.5 Under what circumstances are these timestamped logs being created? _ With Windows Live, you can organise, edit, and share your photos. http://clk.atdmt.com/UKM/go/134665338/direct/01/
RE: Can we write the data to Multiple log
Without sounding contrite, I think the group provided guidance to you yesterday on how to do this? The suggestions were to either configure two rolling file appenders or log to a DB. Why do you need to include anything in your UI? This is only my position on this, but - why do you want to specify which log you want to use in the UI? Doesnt this reduce the value of your logging by quite some degree? Subject: RE: Can we write the data to Multiple log Date: Tue, 18 Aug 2009 12:13:53 +0530 From: raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org Hi, From the UI how can I specify the details to which appender to use. My requirement is like there will be two log: - Complete Information, which contains data along with the stack trace and many more parameters coming from the exception - Simple information saying “There was a error with code and simple details” And in this case I need to log them in two different logs at a time. Can you please send me the samples. Thanks in advance. Regards, Raghuram Raichooti From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: Tuesday, August 18, 2009 7:06 AM To: Log4NET User Subject: Re: Can we write the data to Multiple log Does this example help? ?xml version=1.0 encoding=utf-8 ? log4net appender name=SimpleLayoutFileAppender type=log4net.Appender.FileAppender file value=Logs\Simple.txt / layout type=log4net.Layout.SimpleLayout / /appender appender name=PatternLayoutFileAppender type=log4net.Appender.FileAppender file value=Logs\PatternLayout.txt / layout type=log4net.Layout.PatternLayout conversionPattern value=%5level %date (%logger:%line) - %message%newline / /layout /appender root appender-ref ref=SimpleLayoutFileAppender / appender-ref ref=PatternLayoutFileAppender / /root /log4net From: raghuram.raicho...@accenture.com raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org Sent: Monday, August 17, 2009 4:16:42 AM Subject: Can we write the data to Multiple log Hi, I am using the Rolling File Appender, and in this I would like to write the exception raised to two different logs one with simple information and other with the complete information. In the config file I have two sections defining the paths. ?xml version=1.0 standalone=yes ? SYSTEMINFORMATION SYSTEMIDDIS/SYSTEMID ERRORCODELISTPATH/config/errorCode.xml/ERRORCODELISTPATH /SYSTEMINFORMATION APPENDER MODE=tivoli NAME=RollingLogFileAppender TYPE=log4net.Appender.RollingFileAppender FILENAME VALUE=d://svr_app_prod//logs//app_logs//diss//tivoli.log / APPENDTOFILE VALUE=true / ROLLINGSTYLE VALUE=Size / MAXROLLBACKUPSIZE VALUE=10 / MAXFILESIZE VALUE=10MB / MAXENTRIESPERSECOND VALUE=10 / STATICLOGFILENAME VALUE=true / LAYOUT TYPE=log4net.Layout.PatternLayout CONVERSIONPATTERN VALUE=%date [%thread] %-5level %logger [%property{ndc}] - %message%newline / /LAYOUT /APPENDER APPENDER MODE=application NAME=RollingLogFileAppender TYPE=log4net.Appender.RollingFileAppender FILENAME VALUE=d://svr_app_prod//logs//app_logs//diss//application.log / APPENDTOFILE VALUE=true / ROLLINGSTYLE VALUE=Size / MAXROLLBACKUPSIZE VALUE=50 / MAXFILESIZE VALUE=50MB / MAXENTRIESPERSECOND VALUE=10 / STATICLOGFILENAME VALUE=true / LAYOUT TYPE=log4net.Layout.PatternLayout CONVERSIONPATTERN VALUE=%date [%thread] %-5level %logger [%property{ndc}] - %message%newline / /LAYOUT /APPENDER /DataSetConfiguration In our application we only mention Log.Debug(“Logging Information”). Could you please tell me how to specify the details of the log file. Regards, Raghuram Raichooti This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. _ Celebrate a decade of Messenger with free winks, emoticons, display pics, and more. http://clk.atdmt.com/UKM/go/157562755/direct/01/
RE: Can we write the data to Multiple log
I think the point I failed to make is this; in my opinion, handling the logging from the UI is a bad thing, just configure your application to log as soon as it is started. Ron Grabowski sent a good example of how to do what you want to do, to which you replied. Failing that, just include two rolling fille appeneders in your config file set to look at different levels, i.e. everything for the developers and then a different level for everyone else. I think the biggest question here is what have you tried so far and what problems did you encounter? Subject: RE: Can we write the data to Multiple log Date: Tue, 18 Aug 2009 12:42:53 +0530 From: raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org OK are not suppose to use the DB. Coming to logging. I need to use RollingFileAppenders for both of the Logs. When you say two logs, its one for the Application Developers who needs to get complete information for them to track. And the other log is for the Tivoli server which keeps tracking the information of the logs. And from UI I normally use only one statement saying Private readonly log4net.ILog Log = log4net.logManager.GetLogger(“”) Log.Debug(GetformatedMessage(“Application”)); Log.Debug(GetformatedMessage(“Tivoli”)); I was asking you how can we write the information to the different logs. Regards, Raghuram Raichooti From: Karim Bourouba [mailto:kar...@hotmail.com] Sent: Tuesday, August 18, 2009 12:29 PM To: log4net-user@logging.apache.org Subject: RE: Can we write the data to Multiple log Without sounding contrite, I think the group provided guidance to you yesterday on how to do this? The suggestions were to either configure two rolling file appenders or log to a DB. Why do you need to include anything in your UI? This is only my position on this, but - why do you want to specify which log you want to use in the UI? Doesnt this reduce the value of your logging by quite some degree? Subject: RE: Can we write the data to Multiple log Date: Tue, 18 Aug 2009 12:13:53 +0530 From: raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org Hi, From the UI how can I specify the details to which appender to use. My requirement is like there will be two log: - Complete Information, which contains data along with the stack trace and many more parameters coming from the exception - Simple information saying “There was a error with code and simple details” And in this case I need to log them in two different logs at a time. Can you please send me the samples. Thanks in advance. Regards, Raghuram Raichooti From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: Tuesday, August 18, 2009 7:06 AM To: Log4NET User Subject: Re: Can we write the data to Multiple log Does this example help? ?xml version=1.0 encoding=utf-8 ? log4net appender name=SimpleLayoutFileAppender type=log4net.Appender.FileAppender file value=Logs\Simple.txt / layout type=log4net.Layout.SimpleLayout / /appender appender name=PatternLayoutFileAppender type=log4net.Appender.FileAppender file value=Logs\PatternLayout.txt / layout type=log4net.Layout.PatternLayout conversionPattern value=%5level %date (%logger:%line) - %message%newline / /layout /appender root appender-ref ref=SimpleLayoutFileAppender / appender-ref ref=PatternLayoutFileAppender / /root /log4net From: raghuram.raicho...@accenture.com raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org Sent: Monday, August 17, 2009 4:16:42 AM Subject: Can we write the data to Multiple log Hi, I am using the Rolling File Appender, and in this I would like to write the exception raised to two different logs one with simple information and other with the complete information. In the config file I have two sections defining the paths. ?xml version=1.0 standalone=yes ? SYSTEMINFORMATION SYSTEMIDDIS/SYSTEMID ERRORCODELISTPATH/config/errorCode.xml/ERRORCODELISTPATH /SYSTEMINFORMATION APPENDER MODE=tivoli NAME=RollingLogFileAppender TYPE=log4net.Appender.RollingFileAppender FILENAME VALUE=d://svr_app_prod//logs//app_logs//diss//tivoli.log / APPENDTOFILE VALUE=true / ROLLINGSTYLE VALUE=Size / MAXROLLBACKUPSIZE VALUE=10 / MAXFILESIZE VALUE=10MB / MAXENTRIESPERSECOND VALUE=10 / STATICLOGFILENAME VALUE=true / LAYOUT TYPE=log4net.Layout.PatternLayout CONVERSIONPATTERN VALUE=%date [%thread] %-5level %logger [%property{ndc}] - %message%newline / /LAYOUT /APPENDER APPENDER MODE=application NAME=RollingLogFileAppender TYPE=log4net.Appender.RollingFileAppender FILENAME VALUE=d://svr_app_prod//logs//app_logs//diss
RE: Experiencing locks while using AdoNetAppender
Hi, I have seen similar behaviour when working with Access. I know this wont help, but I found it to be a limitation of file based databases unfortunately :( Subject: Experiencing locks while using AdoNetAppender Date: Tue, 18 Aug 2009 14:29:17 +0200 From: p...@hoogendoorn.nl To: log4net-user@logging.apache.org Hi, I am using the AdoNetAppender for logging messages from multiple application. All the applications log into one sqllite database. Sometimes when a lot of information is logged I am experiencing exceptions like: log4net:ERROR [AdoNetAppender] Exception while writing to database System.Data.SQLite.SQLiteException: The database file is locked database is locked at System.Data.SQLite.SQLite3.Reset(SQLiteStatement stmt) at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt) at System.Data.SQLite.SQLiteCommand.ExecuteNonQuery() at System.Data.SQLite.SQLiteTransaction..ctor(SQLiteConnection connection, Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginTransaction(Boolean deferredLock) at System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel) at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction() at log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events) The default CommandTimeout in the AdoNetAppender on the IDbCommand is 30 seconds, but I would like to influence this timeout in the log4net configuration (file) so that I can influence the timeout on the logging if the database is locked for a longer portion of time. Reducing the timeout may lead to events getting lost, but I prefer that to our application hanging for the full CommandTimeout waiting for the database to become unlocked. Is it possible to configure the timeout using configuration? or would it be better to choose for a solution like deriving from the AdoNetAppender and add the functionality? Thanks in advance for any answers. Patrick **DISCLAIMER** Deze E-mail is uitsluitend bestemd voor de geadresseerde(n). Verstrekking aan en gebruik door anderen is niet toegestaan. De Hoogendoorn Groep sluit iedere aansprakelijkheid uit die voortvloeit uit elektronische verzending. This E-mail is intended exclusively for the addressee(s), and may not be passed on to, or made available for use by any person other than the addressee(s). The Hoogendoorn Group rules out any and every liability resulting from any electronic transmission. *** This message has been scanned by Network Associates' McAfee AntiVirus Technology _ Windows Live Messenger: Celebrate 10 amazing years with free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/
RE: Can we write the data to Multiple log
I am sorry, I am more than willing to provide help to you, but I dont really have the time to go through all of your code. You sent me an entire project. Can you not just explain what you have done so far and what problems you have faced? I know this sounds bad, but there have been quite a few very good examples of routes you can take with this already posted. Subject: RE: Can we write the data to Multiple log Date: Tue, 18 Aug 2009 19:36:55 +0530 From: raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org; log4net-user@logging.apache.org Hi, Please find the sample example which i am doing. and please suggest me if i did something wrong. Thanks Regards, Raghuram Raichooti From: Karim Bourouba [mailto:kar...@hotmail.com] Sent: Tue 18.08.2009 13:18 To: log4net-user@logging.apache.org Subject: RE: Can we write the data to Multiple log I think the point I failed to make is this; in my opinion, handling the logging from the UI is a bad thing, just configure your application to log as soon as it is started. Ron Grabowski sent a good example of how to do what you want to do, to which you replied. Failing that, just include two rolling fille appeneders in your config file set to look at different levels, i.e. everything for the developers and then a different level for everyone else. I think the biggest question here is what have you tried so far and what problems did you encounter? Subject: RE: Can we write the data to Multiple log Date: Tue, 18 Aug 2009 12:42:53 +0530 From: raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org OK are not suppose to use the DB. Coming to logging. I need to use RollingFileAppenders for both of the Logs. When you say two logs, its one for the Application Developers who needs to get complete information for them to track. And the other log is for the Tivoli server which keeps tracking the information of the logs. And from UI I normally use only one statement saying Private readonly log4net.ILog Log = log4net.logManager.GetLogger() Log.Debug(GetformatedMessage(Application)); Log.Debug(GetformatedMessage(Tivoli)); I was asking you how can we write the information to the different logs. Regards, Raghuram Raichooti From: Karim Bourouba [mailto:kar...@hotmail.com] Sent: Tuesday, August 18, 2009 12:29 PM To: log4net-user@logging.apache.org Subject: RE: Can we write the data to Multiple log Without sounding contrite, I think the group provided guidance to you yesterday on how to do this? The suggestions were to either configure two rolling file appenders or log to a DB. Why do you need to include anything in your UI? This is only my position on this, but - why do you want to specify which log you want to use in the UI? Doesnt this reduce the value of your logging by quite some degree? Subject: RE: Can we write the data to Multiple log Date: Tue, 18 Aug 2009 12:13:53 +0530 From: raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org Hi, From the UI how can I specify the details to which appender to use. My requirement is like there will be two log: - Complete Information, which contains data along with the stack trace and many more parameters coming from the exception - Simple information saying There was a error with code and simple details And in this case I need to log them in two different logs at a time. Can you please send me the samples. Thanks in advance. Regards, Raghuram Raichooti From: Ron Grabowski [mailto:rongrabow...@yahoo.com] Sent: Tuesday, August 18, 2009 7:06 AM To: Log4NET User Subject: Re: Can we write the data to Multiple log Does this example help? ?xml version=1.0 encoding=utf-8 ? log4net appender name=SimpleLayoutFileAppender type=log4net.Appender.FileAppender file value=Logs\Simple.txt / layout type=log4net.Layout.SimpleLayout / /appender appender name=PatternLayoutFileAppender type=log4net.Appender.FileAppender file value=Logs\PatternLayout.txt / layout type=log4net.Layout.PatternLayout conversionPattern value=%5level %date (%logger:%line) - %message%newline / /layout /appender root appender-ref ref=SimpleLayoutFileAppender / appender-ref ref=PatternLayoutFileAppender / /root /log4net From: raghuram.raicho...@accenture.com raghuram.raicho...@accenture.com To: log4net-user
RE: Can we write the data to Multiple log
Have you considered logging to a db, then generating reports from there instead? Seems to me to be a bit more elegant than logging to two text files. Subject: Can we write the data to Multiple log Date: Mon, 17 Aug 2009 13:46:42 +0530 From: raghuram.raicho...@accenture.com To: log4net-user@logging.apache.org Hi, I am using the Rolling File Appender, and in this I would like to write the exception raised to two different logs one with simple information and other with the complete information. In the config file I have two sections defining the paths. ?xml version=1.0 standalone=yes ? DataSetConfiguration xmlns=http://www.volkswagen.de/xmldefs/disk/DSLoggingConfiguration.xsd; SYSTEMINFORMATION SYSTEMIDDIS/SYSTEMID ERRORCODELISTPATH/config/errorCode.xml/ERRORCODELISTPATH /SYSTEMINFORMATION APPENDER MODE=tivoli NAME=RollingLogFileAppender TYPE=log4net.Appender.RollingFileAppender FILENAME VALUE=d://svr_app_prod//logs//app_logs//diss//tivoli.log / APPENDTOFILE VALUE=true / ROLLINGSTYLE VALUE=Size / MAXROLLBACKUPSIZE VALUE=10 / MAXFILESIZE VALUE=10MB / MAXENTRIESPERSECOND VALUE=10 / STATICLOGFILENAME VALUE=true / LAYOUT TYPE=log4net.Layout.PatternLayout CONVERSIONPATTERN VALUE=%date [%thread] %-5level %logger [%property{ndc}] - %message%newline / /LAYOUT /APPENDER APPENDER MODE=application NAME=RollingLogFileAppender TYPE=log4net.Appender.RollingFileAppender FILENAME VALUE=d://svr_app_prod//logs//app_logs//diss//application.log / APPENDTOFILE VALUE=true / ROLLINGSTYLE VALUE=Size / MAXROLLBACKUPSIZE VALUE=50 / MAXFILESIZE VALUE=50MB / MAXENTRIESPERSECOND VALUE=10 / STATICLOGFILENAME VALUE=true / LAYOUT TYPE=log4net.Layout.PatternLayout CONVERSIONPATTERN VALUE=%date [%thread] %-5level %logger [%property{ndc}] - %message%newline / /LAYOUT /APPENDER /DataSetConfiguration In our application we only mention Log.Debug(“Logging Information”). Could you please tell me how to specify the details of the log file. Regards, Raghuram Raichooti This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. _ Windows Live Messenger: Celebrate 10 amazing years with free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/
RE: Adding a new column
Do you mean adda new column to be logged? If you do, then you can use property(MY CUSTOM PROPERTY HERE) in the config file. Complimented with log4net.GlobalContext.Properties[taskname] = _taskName; in your code to capture your custom column name (assuming it is called taskname. If you are talking about your DB, then thats something outwith log4net I think. From: henn...@stoverud.no To: log4net-user@logging.apache.org Subject: Adding a new column Date: Mon, 17 Aug 2009 11:25:02 +0200 Hi, I’m using ADONetAppender and now I want to add a separate column where I can automatically log a customer ID for each log entry. How do I go about to implement this? /Henning _ Windows Live Messenger: Happy 10-Year Anniversary—get free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/
RE: Adding custom logging properties
I have to say I only glanced through this very quickly and I am a little confused. I am at work just now, so my attention is split, please bear with me. Are you asking if custom messages can be logged via log4net? If so, then the quick answer is yes. Implementation is very simple as well, but in case I missed your point can you let us know if this is what you are after? Seems like this is the log4net topic of the day today :) Date: Mon, 17 Aug 2009 06:12:29 -0700 From: adamtap...@hotmail.com To: log4net-user@logging.apache.org Subject: Adding custom logging properties Hi, I've been evaluating log4net recently with a view to using the framework as a loggin standard for our enterprise applicaption. I see it very easy to extend the framework, however I have some specific logging requirements and I'm not sure what would be the easiest way implement these with minimal coding. At some time in the future, we aim to build a consolidated logging database that will capture logging data from our server application suite. The information that needs to be logged will differ per service/applicaption and to that end I would aim to have a table schema that has the standard logging columns plus a generic XML column (no defined schema) to act as a property bag for custom information associated with a specific event. We don't have time to develop the logging repository at present, however I'm stressing that we should build logging into our code from the start rather than trying to retro-fitting it later which would be far more costly. So I need my code to be able to fire off logging messages with a list or arbitrary custom properties that get formatted into an XML string. For now the messages can be written to a text file and later we'll configure and AdoNetAppender to write to out logging database. So my questions are: - Is this possible using configuration only? (I susopect not) - If not then which custom objects do I need to create? From what I've seen so far I think I'll need to code my own Layout Class - The ILog interface doesn't doesn't expose a method that takes a property bag (or dictionary), but it appears that the LoggingEvent object does. Does that mean I would have to make my logging calls using ILog.Logger.Log()? - Could someone provide some sample code please? -- View this message in context: http://www.nabble.com/Adding-custom-logging-properties-tp25006538p25006538.html Sent from the Log4net - Users mailing list archive at Nabble.com. _ Windows Live Messenger: Celebrate 10 amazing years with free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/
RE: Adding custom logging properties
Ah, i think I see. Have you considered just logging the XML as a string to the DB, then use something else to parse it at a latter stage? Date: Mon, 17 Aug 2009 06:48:42 -0700 From: adamtap...@hotmail.com To: log4net-user@logging.apache.org Subject: RE: Adding custom logging properties Hi Karim, No that's not my question. Apart from a custom message I also wish to log some custom event data i.e. a collection of properties. The target for this will eventually be a SQL table which has an XML type column i.e. rathert han just adding a customerID I might have 10 different properties to add. Using the global context for this is not an acceptable solution - assuggested in one of the other threads I read. Karim Bourouba wrote: I have to say I only glanced through this very quickly and I am a little confused. I am at work just now, so my attention is split, please bear with me. Are you asking if custom messages can be logged via log4net? If so, then the quick answer is yes. Implementation is very simple as well, but in case I missed your point can you let us know if this is what you are after? Seems like this is the log4net topic of the day today :) Date: Mon, 17 Aug 2009 06:12:29 -0700 From: adamtap...@hotmail.com To: log4net-user@logging.apache.org Subject: Adding custom logging properties Hi, I've been evaluating log4net recently with a view to using the framework as a loggin standard for our enterprise applicaption. I see it very easy to extend the framework, however I have some specific logging requirements and I'm not sure what would be the easiest way implement these with minimal coding. At some time in the future, we aim to build a consolidated logging database that will capture logging data from our server application suite. The information that needs to be logged will differ per service/applicaption and to that end I would aim to have a table schema that has the standard logging columns plus a generic XML column (no defined schema) to act as a property bag for custom information associated with a specific event. We don't have time to develop the logging repository at present, however I'm stressing that we should build logging into our code from the start rather than trying to retro-fitting it later which would be far more costly. So I need my code to be able to fire off logging messages with a list or arbitrary custom properties that get formatted into an XML string. For now the messages can be written to a text file and later we'll configure and AdoNetAppender to write to out logging database. So my questions are: - Is this possible using configuration only? (I susopect not) - If not then which custom objects do I need to create? From what I've seen so far I think I'll need to code my own Layout Class - The ILog interface doesn't doesn't expose a method that takes a property bag (or dictionary), but it appears that the LoggingEvent object does. Does that mean I would have to make my logging calls using ILog.Logger.Log()? - Could someone provide some sample code please? -- View this message in context: http://www.nabble.com/Adding-custom-logging-properties-tp25006538p25006538.html Sent from the Log4net - Users mailing list archive at Nabble.com. _ Windows Live Messenger: Celebrate 10 amazing years with free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/ ;-);-) -- View this message in context: http://www.nabble.com/Adding-custom-logging-properties-tp25006538p25007016.html Sent from the Log4net - Users mailing list archive at Nabble.com. _ Upgrade to Internet Explorer 8 Optimised for MSN. http://extras.uk.msn.com/internet-explorer-8/?ocid=T010MSN07A0716U
RE: Adding custom logging properties
I agree, I have always viewed log4net as an unobtrusive logging framework and heaping things onto it like this could present problems further down the line. Date: Mon, 17 Aug 2009 14:22:22 -0500 Subject: Re: Adding custom logging properties From: rosshink...@gmail.com To: log4net-user@logging.apache.org At a glace, that looks reasonable to me. The only thing I can think of is that if you have a lot of custom properties, your logging code will be somewhat obtrusive. I'm not sure this avoidable, no matter how you approach this problem. -Ross On Mon, Aug 17, 2009 at 12:59 PM, AdamTappis adamtap...@hotmail.com wrote: OK, So far I've created the following 2 very simple classes which appear to give me what I need: class EventPropertiesXMLLayout : XmlLayoutBase { protected override void FormatXml(XmlWriter writer, LoggingEvent loggingEvent) { LogMessage lm = loggingEvent.MessageObject as LogMessage; if (lm != null) { writer.WriteStartElement(LogEntry); writer.WriteStartElement(Message); writer.WriteValue(lm.Message); writer.WriteEndElement(); writer.WriteStartElement(Properties); foreach (DictionaryEntry de in lm.Properties) { writer.WriteStartElement(de.Key.ToString()); writer.WriteValue(de.Value.ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteEndElement(); } } } class LogMessage { private string _message; private Hashtable _properties; public LogMessage(string message) { _message = message; _properties = new Hashtable(); } public string Message { get { return _message; } } public Hashtable Properties { get { return _properties; } } } And then write the following code if I have to collect custom properties: LogMessage lm = new LogMessage(This is a custom log message); lm.Properties.Add(prop1, value1); lm.Properties.Add(prop2, value2); log.Info(lm); Can you see any immediate issues or limitations with this approach? AdamTappis wrote: How about if I create a custom LogMessage Class that has the message and distionary as properties and then write a cutom ObjectRenderer for my custom class. This would give my developers the flexibility of either logging strings or the custom LogMessage if they require additional properties. I guess what it doesn't give me is the flexibility or rendering the object to a file using one format and to a DB using a different formats. Objects of the specified type would always be rendered the same way. AdamTappis wrote: Having a closer look at the documentation, the Properties property of the LoggingEvent class is a PropertiesDictionary which derives from ReadOnlyPropertiesDictionary which menas it can't be written to and hence it's not suitable for my purposes. Any ideas? AdamTappis wrote: Ross, I guess that's why I'm posting here, because I'm trying to devise a pattern and some coding guidelines so that all our applications log consistently. I considered wrapping log4net but all I've read advises against that. So what I'm trying to achieve is an elegant solution that makes the best use of the framework. You're right, I wish to log a collection of Key-Value pairs associated with a given loggin event. e.g. statistics - eventDataduration3ms/durationsize10kb/size/eventData details - eventDatacustomerID3/customerIDorderID10/orderID/eventData The question I'm asking is how best to implement this with log4net? Should I write a wrapper or a helper class that accepts the key-Value pairs collection as a parameter and returns a formattred XML string that then get's logged? Maybe I should be creating a LoggingEvent in code manually, adding the Key-Value pairs to the Properties collection and then using ILog.Logger.Log to actually log the event rather than using Ilog.Info() to log. I could than write a custom layout class that serialises the properties out as an XML string. like I said, I'm not sure and am looking for some disrection. Ideally I would have the following interface available to me: ILog.Info(string message, Dictionary customProperties) and then it would be the configuration that drives how the customProperties are rendered by specifying the approporiate Layout class. That way I could format the customProperties to a file in one way and to a Db as XML etc... without embedding the formatting logic in my code. Ross Hinkley wrote: Adam, How are these properties getting transformed from a logging call to XML? Are you asking if there's a
RE: relative path for config file
Hi There, I understand you desire to have a central directory for log files - but surely if they are all going to live in the \Configs dir, then this directory will always be in the same place on each machine? Other than that, I think unless you want to have a seperate utility to manage your logfiles for you, then you will probably need to set the path in the code :( Raszka - sometimes it is very useful to hold some configuration in an external xml file. Subject: RE: relative path for config file Date: Thu, 6 Aug 2009 08:14:47 +0200 From: ras...@hasam.cz To: log4net-user@logging.apache.org Hi, you can try this: add key=log4net.Config.File value=~\configs\log4net.config / but I'm not sure if this works. What you are using external config file? log4net config can be written directly in web.config. RR Od: Christian Chenier [mailto:cchen...@uottawa.ca] Odesláno: 5. srpna 2009 18:16 Komu: log4net-user@logging.apache.org Předmět: relative path for config file Hi, I use log4net in a C# web application and am having problems configuring it to use a relative path to point to the location of a configuration file external to web.config. In web.config, if I use add key=log4net.Config.File value=C:\somePath\log4net.config / all works fine. However, I would like to avoid having to hard-code the physical path and would like to specify something like add key=log4net.Config.File value=configs\log4net.config / where the configs directory is located in the same directory as web.config (the AppDomain.CurrentDomain.BaseDirectory). However this does not work (I no longer get anything output to my log file when I make that change). I understand that one can programmatically construct a full path from the base directory, but there is surely a way to specify a relative path directly in the web.config file? I have tried modifying the string using leading slash (and backslash), etc. to no avail, and could not find a solution anywhere. Does anyone know how to do this? (As an aside, using a relative path to specify the output file name within the appender works fine, relative to the base directory.) Thanks, Chris Chenier _ Windows Live Messenger: Happy 10-Year Anniversary-get free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/
RE: Defer file creation
Hi Wolfgang, have you considered look at the common logging infrastructure at all? It can work with Log4Net and could be quite useful for you. BR - Karim From: wolfg...@wollinet.com To: log4net-user@logging.apache.org Subject: RE: Defer file creation Date: Tue, 4 Aug 2009 10:35:48 +0200 Hi Ross, all some more details about my setup: - WinForm application - Use of Windows Workflow Foundation for customer specific jobs We use log4net for “normal” application logging. Now I need a solution for generating protocols for the jobs (workflows), meaning, which action were made, errors, and so on. These jobs run maybe once a week, a month or so. Each job should get its own protocol file. My decision for using log4net for that, too, was primarily based on the flexibility log4net offers for defining what gets logged and where. I can activate tracing for these jobs on the fly and I can switch to a different appender and write everything to the database. Currently there is no real process in “analyzing” the protocols. The customers simply want them and sometimes we need them for debugging. I’m fine with using my “own” appender, I was just looking if I missed some small configuration value or something like that. Thx to all for the suggestions and quick responses, Wolfgang From: Ross Hinkley [mailto:rosshink...@gmail.com] Sent: Montag, 3. August 2009 14:19 To: Log4NET User Subject: Re: Defer file creation Wolfgang, If you're separating trace information from activity information, then yes, my (somewhat trite) solution is insufficient. As noted, it is a bit of a hack. The custom appender solution is probably preferable. Are you using the same logfile for every job? That seems a touch awkward to me (more so than one per job), but maybe for your implementation it fits. After these jobs are run and the log files are written, what's your process after that? Do you go in and look to see if any files were made, or is there some automated notification process? If it's the latter, I really like Karim's idea - presumably, you'd have some job set up to let you know there were log files; why not simply run a database report instead? -Ross On Mon, Aug 3, 2009 at 2:19 AM, Wolfgang Trog wolfg...@wollinet.com wrote: Karim, no worries. About the DB … in fact I want to use the flexibility of log4net, to decide where the logs should go (file and/or database), to change the log level on the fly and to separate activities form trace information. So it’s much easier for me, to change the appender (where I simply have to comment one line) than to write the code for writing it to the database and then to a log file. Thx, Wolfgang From: Karim Bourouba [mailto:kar...@hotmail.com] Sent: Montag, 3. August 2009 09:00 To: log4net-user@logging.apache.org Subject: RE: Defer file creation Hi Wolfgang, sorry, but I havent really been paying much attention to this thread I am afraid. Is it not possible for you to write your log to a DB and then create logfiles from that? It seems a bit long-winded, but could be a solution as opposed to creating your own appender. From: wolfg...@wollinet.com To: log4net-user@logging.apache.org Subject: RE: Defer file creation Date: Mon, 3 Aug 2009 08:43:56 +0200 Hi Ross, thx for the suggestion. I can’t defer the logger configuration, because I need basic logging from the beginning. I could probably use a separate log file for each job, but that seems a bit awkward. I think I’ll stick to the “write my own appender” approach for the moment. Thx, Wolfgang From: Ross Hinkley [mailto:rosshink...@gmail.com] Sent: Freitag, 31. Juli 2009 18:02 To: Log4NET User Subject: Re: Defer file creation Off the top of my head: doesn't the logfile only get generated if the logger is configured? Rather than deferring the log file getting created, couldn't you defer execution of the configurator? You could use a getter to run the configurator, like the following: private static ILog _log = LogManager.GetLogger(typeof(Program)); public static ILog log { get { if(!log4net.LogManager.GetRepository().Configured) log4net.Config.XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)); return _log; } } This way, your logger will only get configured (and the file subsequently made) if something is logged. Is it a hack? Absolutely. But it's the quickest way I could think of to answer your question. :) -Ross On Fri, Jul 31, 2009 at 10:23 AM, Wolfgang Trog wolfg...@wollinet.com wrote: For now, I tried a quick hack and modified FileAppender and it’s now working like I want: override public void ActivateOptions() { … if ( m_fileName != null ) { //SafeOpenFile( m_fileName, m_appendToFile ); } else
RE: Defer file creation
My only reason for suggesting it is that you can use it to connect different logging frameworks together. This could be useful for you with the system you are proposing. From: wolfg...@wollinet.com To: log4net-user@logging.apache.org Subject: RE: Defer file creation Date: Tue, 4 Aug 2009 11:01:42 +0200 Not really, since we also use NHibernate, we didn’t look at anything else. But I’ll give it a try. Thx for the hint. Wolfgang From: Karim Bourouba [mailto:kar...@hotmail.com] Sent: Dienstag, 4. August 2009 10:57 To: log4net-user@logging.apache.org Subject: RE: Defer file creation Hi Wolfgang, have you considered look at the common logging infrastructure at all? It can work with Log4Net and could be quite useful for you. BR - Karim From: wolfg...@wollinet.com To: log4net-user@logging.apache.org Subject: RE: Defer file creation Date: Tue, 4 Aug 2009 10:35:48 +0200 Hi Ross, all some more details about my setup: - WinForm application - Use of Windows Workflow Foundation for customer specific jobs We use log4net for “normal” application logging. Now I need a solution for generating protocols for the jobs (workflows), meaning, which action were made, errors, and so on. These jobs run maybe once a week, a month or so. Each job should get its own protocol file. My decision for using log4net for that, too, was primarily based on the flexibility log4net offers for defining what gets logged and where. I can activate tracing for these jobs on the fly and I can switch to a different appender and write everything to the database. Currently there is no real process in “analyzing” the protocols. The customers simply want them and sometimes we need them for debugging. I’m fine with using my “own” appender, I was just looking if I missed some small configuration value or something like that. Thx to all for the suggestions and quick responses, Wolfgang From: Ross Hinkley [mailto:rosshink...@gmail.com] Sent: Montag, 3. August 2009 14:19 To: Log4NET User Subject: Re: Defer file creation Wolfgang, If you're separating trace information from activity information, then yes, my (somewhat trite) solution is insufficient. As noted, it is a bit of a hack. The custom appender solution is probably preferable. Are you using the same logfile for every job? That seems a touch awkward to me (more so than one per job), but maybe for your implementation it fits. After these jobs are run and the log files are written, what's your process after that? Do you go in and look to see if any files were made, or is there some automated notification process? If it's the latter, I really like Karim's idea - presumably, you'd have some job set up to let you know there were log files; why not simply run a database report instead? -Ross On Mon, Aug 3, 2009 at 2:19 AM, Wolfgang Trog wolfg...@wollinet.com wrote: Karim, no worries. About the DB … in fact I want to use the flexibility of log4net, to decide where the logs should go (file and/or database), to change the log level on the fly and to separate activities form trace information. So it’s much easier for me, to change the appender (where I simply have to comment one line) than to write the code for writing it to the database and then to a log file. Thx, Wolfgang From: Karim Bourouba [mailto:kar...@hotmail.com] Sent: Montag, 3. August 2009 09:00 To: log4net-user@logging.apache.org Subject: RE: Defer file creation Hi Wolfgang, sorry, but I havent really been paying much attention to this thread I am afraid. Is it not possible for you to write your log to a DB and then create logfiles from that? It seems a bit long-winded, but could be a solution as opposed to creating your own appender. From: wolfg...@wollinet.com To: log4net-user@logging.apache.org Subject: RE: Defer file creation Date: Mon, 3 Aug 2009 08:43:56 +0200 Hi Ross, thx for the suggestion. I can’t defer the logger configuration, because I need basic logging from the beginning. I could probably use a separate log file for each job, but that seems a bit awkward. I think I’ll stick to the “write my own appender” approach for the moment. Thx, Wolfgang From: Ross Hinkley [mailto:rosshink...@gmail.com] Sent: Freitag, 31. Juli 2009 18:02 To: Log4NET User Subject: Re: Defer file creation Off the top of my head: doesn't the logfile only get generated if the logger is configured? Rather than deferring the log file getting created, couldn't you defer execution of the configurator? You could use a getter to run the configurator, like the following: private static ILog _log = LogManager.GetLogger(typeof(Program)); public static ILog log { get { if(!log4net.LogManager.GetRepository().Configured) log4net.Config.XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)); return _log; } } This way, your logger
RE: Mixed Logs
I may be mis-reading this, but isnt the value after the timestamp the thread ID? Date: Tue, 4 Aug 2009 09:05:09 -0500 Subject: Re: Mixed Logs From: rosshink...@gmail.com To: log4net-user@logging.apache.org Do these processes run on different computers? Correct me if I'm wrong, doesn't log4net use local system time for timestamps (the time from the logging machine, not necessarily where the log is located)? -Ross On Tue, Aug 4, 2009 at 8:51 AM, Diego Jancic die...@engineerica.com wrote: Hi Guys, I’ve got an application that uses log4net everywhere and logs a lot of things. Yesterday I leave running some hardware stress tests all the night, and today I found something weird in the logs. The app ran near 1000 test, and 2 of them failed, but just before the failed test it logged something like this: 2009-08-04 04:42:41,846 [1] DEBUG XXX.Communications.Messages.ReadMemoryMessage - Downloading memory. Start: 5120 -- Length: 1024 2009-08-04 04:42:54,046 [1] DEBUG XXX.Communications.Messages.ReadMemoryMessage - Downloading memory. Start: 6144 -- Length: 412 2009-08-04 04:42:42,073 [1] INFO XXX.UI.Admin.Win.MainForm - Test completed OK! 2009-08-04 04:42:54,049 [1] INFO XXX.UI.Admin.Win.MainForm - - 2009-08-04 04:42:54,050 [1] INFO XXX.UI.Admin.Win.MainForm - Cleaning scans before start. Look at the 3rd log, it’s second part (42) is between 2 logs that happened after it (second 54) Well, it’s hard to reproduce the problem in the application. Do you know why it could happen? Thanks, Diego _ Windows Live Messenger: Celebrate 10 amazing years with free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/
RE: Defer file creation
Hi Wolfgang, sorry, but I havent really been paying much attention to this thread I am afraid. Is it not possible for you to write your log to a DB and then create logfiles from that? It seems a bit long-winded, but could be a solution as opposed to creating your own appender. From: wolfg...@wollinet.com To: log4net-user@logging.apache.org Subject: RE: Defer file creation Date: Mon, 3 Aug 2009 08:43:56 +0200 Hi Ross, thx for the suggestion. I can’t defer the logger configuration, because I need basic logging from the beginning. I could probably use a separate log file for each job, but that seems a bit awkward. I think I’ll stick to the “write my own appender” approach for the moment. Thx, Wolfgang From: Ross Hinkley [mailto:rosshink...@gmail.com] Sent: Freitag, 31. Juli 2009 18:02 To: Log4NET User Subject: Re: Defer file creation Off the top of my head: doesn't the logfile only get generated if the logger is configured? Rather than deferring the log file getting created, couldn't you defer execution of the configurator? You could use a getter to run the configurator, like the following: private static ILog _log = LogManager.GetLogger(typeof(Program)); public static ILog log { get { if(!log4net.LogManager.GetRepository().Configured) log4net.Config.XmlConfigurator.Configure(new FileInfo(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile)); return _log; } } This way, your logger will only get configured (and the file subsequently made) if something is logged. Is it a hack? Absolutely. But it's the quickest way I could think of to answer your question. :) -Ross On Fri, Jul 31, 2009 at 10:23 AM, Wolfgang Trog wolfg...@wollinet.com wrote: For now, I tried a quick hack and modified FileAppender and it’s now working like I want: override public void ActivateOptions() { … if ( m_fileName != null ) { //SafeOpenFile( m_fileName, m_appendToFile ); } else { LogLog.Warn( FileAppender: File option not set for appender [ + Name + ]. ); LogLog.Warn( FileAppender: Are you using FileAppender instead of ConsoleAppender? ); } } I would prefer a solution, where I don’t have to use my own appender, but at least I have a workaround. Regards, Wolfgang From: Wolfgang Trog [mailto:wolfg...@wollinet.com] Sent: Freitag, 31. Juli 2009 17:15 To: 'Log4NET User' Subject: RE: Defer file creation I want to create protocols for jobs that can be executed in our application, preferably one file per job and execution. But I don’t want a file, if the job is not executed. The jobs are only executed once a month for example. Thx for the quick response ! Wolfgang From: Karim Bourouba [mailto:kar...@hotmail.com] Sent: Freitag, 31. Juli 2009 17:06 To: log4net-user@logging.apache.org Subject: RE: Defer file creation Hi There, I dont think I have an answer to your question just now - but can I ask why you would prefer to defer creating the log file? From: wolfg...@wollinet.com To: log4net-user@logging.apache.org Subject: Defer file creation Date: Fri, 31 Jul 2009 16:15:28 +0200 Hi Everbody, I’m looking for a way to defer the creation of the log file until the first entry is logged. I want to use log4net for writing protocols for jobs that can be executed in my application. With my current configuration the file is created during startup which makes no sense if the job doesn’t run. My current configuration: appender name=… type=log4net.Appender.RollingFileAppender file value=. / appendToFile value=false / rollingStyle value=Date / datePattern value=_MM_dd.\tx\t / staticLogFileName value=false / threshold value=INFO / layout type=log4net.Layout.PatternLayout conversionPattern value=%date;%level;%m%n / /layout /appender One possibility seems to be to generate the appender programmatically, but then I lose a lot of flexibility. Another one is writing my own appender (or subclassing an existing one). Is there another way ? Any help is appreciated, Wolfgang Share your memories online with anyone you want. Learn more. _ Windows Live Messenger: Celebrate 10 amazing years with free winks and emoticons. http://clk.atdmt.com/UKM/go/157562755/direct/01/
RE: Please release a version that is officially endorsed by the ASF
Log4net is used all over the world by a multitude of different organisations in any number of applications. I use it at work in production systems - my bosses trust me enough to understand that I am not going to suggest duff technology. It's up to you to make the case by illustrating the many, many successul applications of log4net across the world. Subject: Please release a version that is officially endorsed by the ASF Date: Wed, 17 Jun 2009 14:24:01 +0800 From: michael.simm...@uwa.edu.au To: log4net-user@logging.apache.org I'm avocating the use of log4net where I work and phases like not officially endorsed and incubation get translated to beta and unstable. If nobody is willing to actually release an updated version (as it seems from the mailing list) how about log4net-1.2.10.1.zip and just including the 1.2.10 dll and version 1.2.10.1 readme file that says now endorsed Michael Simmons Analyst Programmer michael.simm...@uwa.edu.au Information Technology Services,Information Services Division The University of Western Australia CRICOS: 00126G M463, 35 Stirling Highway, Crawley, WA, 6009 Telephone: 6488 4792 Fax: 6488 3861 _ MSN straight to your mobile - news, entertainment, videos and more. http://clk.atdmt.com/UKM/go/147991039/direct/01/
RE: Key cannot be null error
Hi Gary, I have access to an SQL Server, so I will try out my code against it later this evening. If you did follow my post on DevShed, then we will more or less have the same code. If it produces the same error or not, I will post back the results here. Date: Thu, 21 May 2009 20:57:14 + From: lewd_revel...@yahoo.co.uk Subject: Re: Key cannot be null error To: log4net-user@logging.apache.org Thanks for your replies Karim Radovan. I have attempted to track down the problem with the log4net source, but this doesnt seem to have yielded much success. I am thinking that this could possibly be an error with MySql connector as opposed to log4net, after all this doesnt seem to be happening with SQL Server or Oracle (or at least it isnt being reported). Karim, I think I followed your example on DevShed concerning this setup, I would like to thankyou for putting that together and I look forward to reading your blog article on this, I hope one of us will be able to overcome this problem - unfortunately, I dont have access to another DB to test this out on, but it would be nice to hear back from someone using the same code with Oracle or SQL Server. From: Karim Bourouba kar...@hotmail.com To: log4net-user@logging.apache.org Sent: Thursday, 21 May, 2009 11:52:56 Subject: RE: Key cannot be null error Hi Radovan, thats a great idea, I will give it a go and report back. Many thanks Subject: RE: Key cannot be null error Date: Thu, 21 May 2009 12:43:15 +0200 From: ras...@hasam.cz To: log4net-user@logging.apache.org Hello, you can try this: download log4net sources and attach them to your project instead of reference to log4net.dll. Now you'll be able to debug inside of AdonetAppender and you can find what exactly is null and guess the correct value, I hope. Radovan Raszka Od: Karim Bourouba [mailto:kar...@hotmail.com] Odesláno: 21. května 2009 10:43 Komu: log4net-user@logging.apache.org Předmět: RE: Key cannot be null error Hi Gary, I am actually having the same problem as you - I think. I definitely get the same error as you. Can I ask if you are using MySql at all? Unfortunately though, I havent had any luck with asking this question on this list, it would appear that the list is not as busy as I thought it initially was, or the other subscribers are unable to comment. To help you with your problem, if it isnt the same as mine, would be to post your code on the list itself. That gives everyone the chance to take a look and see if they can spot the issue. If you do have the same problem as me, could you post your solution should you fix it? That way others, including myself will be able to resolve this in future. Date: Wed, 20 May 2009 22:02:14 + From: lewd_revel...@yahoo.co.uk Subject: Key cannot be null error To: log4net-user@logging.apache.org Hello, Could someone explain to me what the following error means please? log4net:ERROR [AdoNetAppender] Could not open database connection [] System.ArgumentNullException: Key cannot be null. Parameter name: key I encounter this error when trying to log to my database. The rows are updated, but I get this message pop up on the console. I dont know how busy this list is, but I would really appreciate it if someone could lend a hand. TIA Share your photos with Windows Live Photos - Free. Try it Now! Windows Live Messenger just got better. Find out more! _ Share your photos with Windows Live Photos - Free. http://clk.atdmt.com/UKM/go/134665338/direct/01/
RE: Key cannot be null error
Hi Gary, I am actually having the same problem as you - I think. I definitely get the same error as you. Can I ask if you are using MySql at all? Unfortunately though, I havent had any luck with asking this question on this list, it would appear that the list is not as busy as I thought it initially was, or the other subscribers are unable to comment. To help you with your problem, if it isnt the same as mine, would be to post your code on the list itself. That gives everyone the chance to take a look and see if they can spot the issue. If you do have the same problem as me, could you post your solution should you fix it? That way others, including myself will be able to resolve this in future. Date: Wed, 20 May 2009 22:02:14 + From: lewd_revel...@yahoo.co.uk Subject: Key cannot be null error To: log4net-user@logging.apache.org Hello, Could someone explain to me what the following error means please? log4net:ERROR [AdoNetAppender] Could not open database connection [] System.ArgumentNullException: Key cannot be null. Parameter name: key I encounter this error when trying to log to my database. The rows are updated, but I get this message pop up on the console. I dont know how busy this list is, but I would really appreciate it if someone could lend a hand. TIA _ Share your photos with Windows Live Photos – Free. http://clk.atdmt.com/UKM/go/134665338/direct/01/
RE: Key cannot be null error
Hi Radovan, thats a great idea, I will give it a go and report back. Many thanks Subject: RE: Key cannot be null error Date: Thu, 21 May 2009 12:43:15 +0200 From: ras...@hasam.cz To: log4net-user@logging.apache.org Hello, you can try this: download log4net sources and attach them to your project instead of reference to log4net.dll. Now you'll be able to debug inside of AdonetAppender and you can find what exactly is null and guess the correct value, I hope. Radovan Raszka Od: Karim Bourouba [mailto:kar...@hotmail.com] Odesláno: 21. května 2009 10:43 Komu: log4net-user@logging.apache.org Předmět: RE: Key cannot be null error Hi Gary, I am actually having the same problem as you - I think. I definitely get the same error as you. Can I ask if you are using MySql at all? Unfortunately though, I havent had any luck with asking this question on this list, it would appear that the list is not as busy as I thought it initially was, or the other subscribers are unable to comment. To help you with your problem, if it isnt the same as mine, would be to post your code on the list itself. That gives everyone the chance to take a look and see if they can spot the issue. If you do have the same problem as me, could you post your solution should you fix it? That way others, including myself will be able to resolve this in future. Date: Wed, 20 May 2009 22:02:14 + From: lewd_revel...@yahoo.co.uk Subject: Key cannot be null error To: log4net-user@logging.apache.org Hello, Could someone explain to me what the following error means please? log4net:ERROR [AdoNetAppender] Could not open database connection [] System.ArgumentNullException: Key cannot be null. Parameter name: key I encounter this error when trying to log to my database. The rows are updated, but I get this message pop up on the console. I dont know how busy this list is, but I would really appreciate it if someone could lend a hand. TIA Share your photos with Windows Live Photos - Free. Try it Now! _ View your Twitter and Flickr updates from one place - Learn more! http://clk.atdmt.com/UKM/go/137984870/direct/01/
Strange Syste.ArgumentNullException
Hi All, I am getting a strange System.ArgumentNullException when using a AdoNetAppender. The message I am passing is is caught and logged to the DB, but on the console I am getting the following error: log4net:ERROR [AdoNetAppender] Could not open database connection [] System.ArgumentNullException: Key cannot be null. Parameter name: key at System.Collections.Hashtable.get_Item(Object key) at MySql.Data.MySqlClient.MySqlPoolManager.GetPool(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlConnection.Open() at log4net.Appender.AdoNetAppender.InitializeDatabaseConnection() I have checked my app.config, but I am unsure as to where this error is coming from and I am also unsure as to why the message I am trying to log is getting logged to my DB. Could someone help me out please? I am certain that someone on this list will be able to give me a clue as to where to start looking... _ Beyond Hotmail — see what else you can do with Windows Live. http://clk.atdmt.com/UKM/go/134665375/direct/01/
SystemNullReferenceException usgin log4net with MySql
Hi There, I have been working with log4net now for a few weeks, after some work I have managed to use the ADONetAppender to log to a MySQL DB. However, although I can get messages into my DB, I am getting the following error on my console: log4net:ERROR [AdoNetAppender] Could not open database connection [] System.ArgumentNullException: Key cannot be null. Parameter name: key at System.Collections.Hashtable.get_Item(Object key) at MySql.Data.MySqlClient.MySqlPoolManager.GetPool(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlConnection.Open() at log4net.Appender.AdoNetAppender.InitializeDatabaseConnection() log4net:ERROR [AdoNetAppender] Could not open database connection [] System.ArgumentNullException: Key cannot be null. Parameter name: key at System.Collections.Hashtable.get_Item(Object key) at MySql.Data.MySqlClient.MySqlPoolManager.GetPool(MySqlConnectionStringBuilder settings) at MySql.Data.MySqlClient.MySqlConnection.Open() at log4net.Appender.AdoNetAppender.InitializeDatabaseConnection() The code for logging to my DB is as follows: using log4net; using log4net.Appender; using log4net.Repository.Hierarchy; using MySql.Data.MySqlClient; using System; using System.Collections.Generic; using System.Data.OleDb; using System.Text; namespace BGCPLogger.LogSetup { public class SetUpLog { internal readonly ILog _log = LogManager.GetLogger(typeof(SetUpLog)); /*/ internal SetUpLog() { log4net.Config.XmlConfigurator.Configure(); } /*/ public SetUpLog(string dbConn) { log4net.Config.XmlConfigurator.Configure(); createAdoSettings(dbConn); } /*/ private Hierarchy hierachy() { Hierarchy h = (Hierarchy)log4net.LogManager.GetRepository(); return h; } /*/ private AdoNetAppender adoAppender() { Hierarchy myHierarchy = hierachy(); if (myHierarchy != null) { AdoNetAppender adoApp = (AdoNetAppender)myHierarchy.Root.GetAppender(ADONetAppender); return adoApp; } return null; } /*/ private void createAdoSettings(string dbConn) { AdoNetAppender myAppender = adoAppender(); if (myAppender != null) { myAppender.ConnectionString = dbConn; myAppender.UseTransactions = true; myAppender.ActivateOptions(); } } } } My log4net section in my app.config looks like this: log4net root level value=INFO / appender-ref ref=ColoredConsoleAppender / appender-ref ref=ADONetAppender / /root appender name=ADONetAppender type=log4net.Appender.ADONetAppender bufferSize value=1 / connectionType value=MySql.Data.MySqlClient.MySqlConnection, MySql.Data / commandText value=insert into `tbl_lg_mlog_task_logs`(mlog_lastuser,mlog_thread,mlog_level,mlog_logger,mlog_message,mlog_exception)values('',?thread,?log_level,'My Log',?message,?exception) / parameter parameterName value=?thread / dbType value=String / size value=255 / layout type=log4net.Layout.PatternLayout conversionPattern value=%t / /layout /parameter parameter parameterName value=?log_level / dbType value=String / size value=50 / layout type=log4net.Layout.PatternLayout conversionPattern value=%p / /layout /parameter parameter parameterName value=?logger / dbType value=String / size value=512 / layout type=log4net.Layout.PatternLayout conversionPattern value=%c / /layout /parameter parameter parameterName value=?host / dbType value=String / size value=50 / layout type=log4net.Layout.PatternLayout conversionPattern value=%X{host} / /layout /parameter parameter parameterName value=?message / dbType value=String / size value=4000 / layout type=log4net.Layout.PatternLayout conversionPattern value=%m / /layout /parameter parameter parameterName value=?exception / dbType value=String / size value=2000 / layout type=log4net.Layout.ExceptionLayout / /parameter /appender appender name=LogFileAppender type=log4net.Appender.FileAppender param name=File value=C:\log-file.txt / param name=AppendToFile value=true / layout type=log4net.Layout.PatternLayout param name=Header value=[Header]\r\n/ param name=Footer value=[Footer]\r\n/ /layout filter type=log4net.Filter.LevelRangeFilter param name=LevelMin value=DEBUG / param name=LevelMax value=WARN / /filter /appender appender name=ColoredConsoleAppender type=log4net.Appender.ColoredConsoleAppender mapping level value=INFO / foreColor value=Green, HighIntensity / /mapping mapping level value=Warn / foreColor value=Cyan, HighIntensity / /mapping mapping level value=Fatal / foreColor value=Red, HighIntensity / /mapping mapping level value=Error / foreColor value=Yellow, HighIntensity / /mapping mapping level value=Debug / foreColor value=Cyan, HighIntensity / /mapping layout type=log4net.Layout.PatternLayout