You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by vikas manghani <vi...@datamatics.com> on 2010/11/22 14:13:38 UTC
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
Posted by vikas manghani <vi...@datamatics.com>.
Hi Karim
That is right. I want only one instance of the application to run at any point in time. If the user tries to start a second instance, app should show a custom message to the user.
I have just one log file name and log4net tries to acquire a lock on that and hence it fails. But is there a way, the notepad instance popping up with the error can be prevented. I just want that the log4net exception should not be shown to the user since I am already showing a custom message.
Thanks and regards
Vikas Manghani
----- Original Message -----
From: Karim Bourouba
To: 'Log4NET User' ; 'vikas manghani'
Sent: Monday, November 22, 2010 7:00 PM
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.manghani@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: [BULK] RE: Error while starting second instance of application
Posted by vikas manghani <vi...@datamatics.com>.
What I am referring to is the fail-stop nature of log4net i.e."log4net will not throw unexpected exceptions at run-time potentially causing your application to crash.If for any reason, log4net throws an uncaught exception (except for ArgumentException and ArgumentNullException which may be thrown), please send an email to the log4net-user@logging.apache.org mailing list."
Probably I have got this all wrong. But what I need is a way to suppress the log4net exception from showing up to the user in notepad. If there is no such way then I will try to see if I can use XmlConfigurator.Configure to delay the logging mechanism.
Thanks and regards
Vikas Manghani
----- Original Message -----
From: Karim Bourouba
To: 'Log4NET User' ; 'vikas manghani'
Sent: Monday, November 22, 2010 8:50 PM
Subject: [BULK] 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.manghani@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
To: 'Log4NET User'
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:karym6@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.manghani@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.
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
Posted by Karim Bourouba <ka...@hotmail.com>.
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.manghani@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 <ma...@prouse.org>
To: 'Log4NET User' <ma...@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:karym6@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.manghani@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: Error while starting second instance of application
Posted by vikas manghani <vi...@datamatics.com>.
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
To: 'Log4NET User'
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:karym6@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.manghani@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: Error while starting second instance of application
Posted by Robert Prouse <ro...@prouse.org>.
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:karym6@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.manghani@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
Posted by Karim Bourouba <ka...@hotmail.com>.
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.manghani@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.