You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "tmct (via GitHub)" <gi...@apache.org> on 2025/01/31 07:02:24 UTC
[I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
tmct opened a new issue, #223:
URL: https://github.com/apache/logging-log4net/issues/223
Hi,
A more serious problem than the one I reported yesterday: we cannot upgrade from 2.0.15 to 2.0.17 because our key FileAppender is completely failing to write anything to the main log file.
```
log4net: Opening file for writing [/my/code/is/here/bin/Debug/net8.0/log_20250130-185019-0634.txt] append [False]
log4net:ERROR [FileAppender] ErrorCode: FileOpenFailure. OpenFile(/my/code/is/here/bin/Debug/net8.0/log_20250130-185019-0634.txt,False) call failed.
System.NullReferenceException: Object reference not set to an instance of an object.
at log4net.Appender.FileAppender.OpenFile(String fileName, Boolean append)
at log4net.Appender.FileAppender.SafeOpenFile(String fileName, Boolean append)
log4net: Opening file for writing [/my/code/is/here/bin/Debug/net8.0/log_20250130-185019-0634.txt] append [False]
```
This appears to be another case of the problem witnessed in #118 that precipitated the release of 2.0.17 - m_lockingModel is now set lazily, and may be null when accessed. ActivateOptions is immune to this: it creates the locking model if it does not exist, so I was wondering if FileAppender.OpenFile should copy that behaviour - or possible we could encapsulate the lazy setting into the LockingModel property? I'm not sure why ActivateOptions seemingly hasn't been called before this - is that indicative of a bug or race condition elsewhere?
Would you mind if we fixed 2.x please?
Thanks,
Tom
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2626870252
@tmct thanks.
There are some breaking changes in 3.x, but most of the consumers don't have to change anything.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "tmct (via GitHub)" <gi...@apache.org>.
tmct commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2626824301
Hi @FreeAndNil - the 3.x upgrade isn't something we've attempted yet as this would probably be a more serious undertaking for upgrading our large pile of legacy software that all shares a version of log4net, but I can give it a go on this app! Will let you know, thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil closed issue #223: NullReferenceException in OpenFile: locking model not instantiated
URL: https://github.com/apache/logging-log4net/issues/223
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "tmct (via GitHub)" <gi...@apache.org>.
tmct commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2626513220
I forgot to mention: unlike #118 this error manifests very early in the run of the application, just after logging is fully configured. It then spams stdout or err with hundreds of the "log4net: Opening file for writing" lines but with no error underneath
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "tmct (via GitHub)" <gi...@apache.org>.
tmct commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2650583387
(And indeed, I didn't get the chance to try on that isolated app, would have to dig that up again, sorry)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2626663649
Hi @tmct,
does this problem occur in log4net 3.0.3?
We won't fix bugs in 2.x because of the trouble associated with building for the legacy frameworks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "tmct (via GitHub)" <gi...@apache.org>.
tmct commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2650582232
Hi @FreeAndNil - I would love to attempt a log4net 3.x migration but unfortunately it is a relatively low priority for me at work at the moment, sorry. Will let you know when we have a go! Thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2650599143
@tmct no problem, please re-open when you find the time.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "FreeAndNil (via GitHub)" <gi...@apache.org>.
FreeAndNil commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2650042985
@tmct were you successful?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] NullReferenceException in OpenFile: locking model not instantiated (logging-log4net)
Posted by "tmct (via GitHub)" <gi...@apache.org>.
tmct commented on issue #223:
URL: https://github.com/apache/logging-log4net/issues/223#issuecomment-2626606795
Oh, and - no log file of that name is ever produced... Neither during nor after the run of my application.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org