Dominik Psenner (JIRA | 2 Sep 15:59 2014
Picon

[jira] [Resolved] (LOG4NET-439) Log file overwritten by rollingLogFileAppender after date-change with rolling style = date


     [
https://issues.apache.org/jira/browse/LOG4NET-439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominik Psenner resolved LOG4NET-439.
-------------------------------------
    Resolution: Duplicate

Keeping a maximum number of backups when rolling over date/time boundaries is currently not supported.

> Log file overwritten by rollingLogFileAppender after date-change with rolling style = date
> ------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-439
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-439
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.13
>         Environment: Windows XP, Windows server 2008, .Net 4.0
>            Reporter: Gerard de Leeuw
>            Priority: Minor
>
> When logging from the main thread after a date change and the maxsize of backups is reached, the existing
log lines of other threads is removed from the file (or file is overwritten). Logging from other (sub)
threads don't affect the file contents.
> Relevant appender configuration:
> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
> <appendToFile value="true" />
> <staticLogFileName value="false" />
(Continue reading)

Dominik Psenner (JIRA | 2 Sep 15:59 2014
Picon

[jira] [Closed] (LOG4NET-439) Log file overwritten by rollingLogFileAppender after date-change with rolling style = date


     [
https://issues.apache.org/jira/browse/LOG4NET-439?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dominik Psenner closed LOG4NET-439.
-----------------------------------
    Assignee: Dominik Psenner

> Log file overwritten by rollingLogFileAppender after date-change with rolling style = date
> ------------------------------------------------------------------------------------------
>
>                 Key: LOG4NET-439
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-439
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.13
>         Environment: Windows XP, Windows server 2008, .Net 4.0
>            Reporter: Gerard de Leeuw
>            Assignee: Dominik Psenner
>            Priority: Minor
>
> When logging from the main thread after a date change and the maxsize of backups is reached, the existing
log lines of other threads is removed from the file (or file is overwritten). Logging from other (sub)
threads don't affect the file contents.
> Relevant appender configuration:
> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
> <appendToFile value="true" />
> <staticLogFileName value="false" />
> <rollingStyle value="Date" />
(Continue reading)

Gerard de Leeuw (JIRA | 2 Sep 14:37 2014
Picon

[jira] [Created] (LOG4NET-439) Log file overwritten by rollingLogFileAppender after date-change with rolling style = date

Gerard de Leeuw created LOG4NET-439:
---------------------------------------

             Summary: Log file overwritten by rollingLogFileAppender after date-change with rolling style = date
                 Key: LOG4NET-439
                 URL: https://issues.apache.org/jira/browse/LOG4NET-439
             Project: Log4net
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 1.2.13
         Environment: Windows XP, Windows server 2008, .Net 4.0
            Reporter: Gerard de Leeuw
            Priority: Minor

When logging from the main thread after a date change and the maxsize of backups is reached, the existing log
lines of other threads is removed from the file (or file is overwritten). Logging from other (sub) threads
don't affect the file contents.

Relevant appender configuration:
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<appendToFile value="true" />
<staticLogFileName value="false" />
<rollingStyle value="Date" />
<datePattern value="yyyy-MM-dd'.log'" />
<maxSizeRollBackups value="2" />

--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

(Continue reading)

Jeff Armbruster (JIRA | 21 Aug 23:16 2014
Picon

[jira] [Created] (LOG4NET-438) SmtpAppender not working

Jeff Armbruster created LOG4NET-438:
---------------------------------------

             Summary: SmtpAppender not working
                 Key: LOG4NET-438
                 URL: https://issues.apache.org/jira/browse/LOG4NET-438
             Project: Log4net
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 1.2.13
         Environment: Windows 7, Visual Studio 2013, ASP.Net 4.5.2
            Reporter: Jeff Armbruster
            Priority: Blocker

SendBuffer and SendEmail are never called.

I've tried many different configurations.

Here's my setup.

My config:

    <appender name="SmtpAppender" type="log4net.Appender.SmtpAppender">
      <to value=""******** />
      <from value="jeff <at> apexenergetics.com" />
      <subject value="test logging message" />
      <smtpHost value="smtp.gmail.com" />
      <password value="*************** " />
      <userName value="******" />
      <authentication value="Basic" />
(Continue reading)

Mike Barry (JIRA | 20 Aug 15:44 2014
Picon

[jira] [Updated] (LOG4NET-437) LogicalThreadContext data does not flow properly using Async and Await


     [
https://issues.apache.org/jira/browse/LOG4NET-437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Barry updated LOG4NET-437:
-------------------------------

    Description: 
LogicalThreadContext doesn't work properly when using Async and Await. The current NDC call stack gets
corrupted because the logical data context is not immutable. (See:
http://blog.stephencleary.com/2013/04/implicit-async-context-asynclocal.html for the gory
details). I've attached a Program.cs that demonstrates the issue. You will see with an unpatched log4net
the thread context is corrupted compared to the proper implementation in MyStack and the console logger.
An entry like:

LOG4NET Main 1 A 2 A: </MoreWork>
LOG4NET Main 1 A 2 A: </MoreWork>

is invalid and should not be possible in a properly working thread context.

I've attached a VERY naive patch that corrects the issue.

  was:
LogicalThreadContext doesn't work properly when using Async and Await. The current NDC call stack gets
corrupted because the logical data context is not immutable. (See:
http://blog.stephencleary.com/2013/04/implicit-async-context-asynclocal.html for the gory
details). I've attached a Program.cs that demonstrates the issue. You will see with an unpatched log4net
the thread context is corrupted compared to the proper implementation in MyStack and the console logger.
An entry like:

(Continue reading)

Mike Barry (JIRA | 20 Aug 15:42 2014
Picon

[jira] [Updated] (LOG4NET-437) LogicalThreadContext data does not flow properly using Async and Await


     [
https://issues.apache.org/jira/browse/LOG4NET-437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Barry updated LOG4NET-437:
-------------------------------

    Attachment: LogicalThreadContext.diff

Part 2 of a naive patch to solve the issue.

> LogicalThreadContext data does not flow properly using Async and Await
> ----------------------------------------------------------------------
>
>                 Key: LOG4NET-437
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-437
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.9, 1.2.10, 1.2.11, 1.2.12, 1.2.13
>         Environment: Windows 7, .NET 4.5
>            Reporter: Mike Barry
>         Attachments: LogicalThreadContext.diff, Program.cs, ThreadContextStacks.diff
>
>
> LogicalThreadContext doesn't work properly when using Async and Await. The current NDC call stack gets
corrupted because the logical data context is not immutable. (See:
http://blog.stephencleary.com/2013/04/implicit-async-context-asynclocal.html for the gory
details). I've attached a Program.cs that demonstrates the issue. You will see with an unpatched log4net
the thread context is corrupted compared to the proper implementation in MyStack and the console logger.
(Continue reading)

Mike Barry (JIRA | 20 Aug 15:42 2014
Picon

[jira] [Updated] (LOG4NET-437) LogicalThreadContext data does not flow properly using Async and Await


     [
https://issues.apache.org/jira/browse/LOG4NET-437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Barry updated LOG4NET-437:
-------------------------------

    Attachment: ThreadContextStacks.diff

Part 1 of a naive patch to solve the issue.

> LogicalThreadContext data does not flow properly using Async and Await
> ----------------------------------------------------------------------
>
>                 Key: LOG4NET-437
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-437
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.9, 1.2.10, 1.2.11, 1.2.12, 1.2.13
>         Environment: Windows 7, .NET 4.5
>            Reporter: Mike Barry
>         Attachments: LogicalThreadContext.diff, Program.cs, ThreadContextStacks.diff
>
>
> LogicalThreadContext doesn't work properly when using Async and Await. The current NDC call stack gets
corrupted because the logical data context is not immutable. (See:
http://blog.stephencleary.com/2013/04/implicit-async-context-asynclocal.html for the gory
details). I've attached a Program.cs that demonstrates the issue. You will see with an unpatched log4net
the thread context is corrupted compared to the proper implementation in MyStack and the console logger.
(Continue reading)

Mike Barry (JIRA | 20 Aug 15:42 2014
Picon

[jira] [Updated] (LOG4NET-437) LogicalThreadContext data does not flow properly using Async and Await


     [
https://issues.apache.org/jira/browse/LOG4NET-437?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Barry updated LOG4NET-437:
-------------------------------

    Attachment: Program.cs

Demos the issue

> LogicalThreadContext data does not flow properly using Async and Await
> ----------------------------------------------------------------------
>
>                 Key: LOG4NET-437
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-437
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.9, 1.2.10, 1.2.11, 1.2.12, 1.2.13
>         Environment: Windows 7, .NET 4.5
>            Reporter: Mike Barry
>         Attachments: LogicalThreadContext.diff, Program.cs, ThreadContextStacks.diff
>
>
> LogicalThreadContext doesn't work properly when using Async and Await. The current NDC call stack gets
corrupted because the logical data context is not immutable. (See:
http://blog.stephencleary.com/2013/04/implicit-async-context-asynclocal.html for the gory
details). I've attached a Program.cs that demonstrates the issue. You will see with an unpatched log4net
the thread context is corrupted compared to the proper implementation in MyStack and the console logger.
(Continue reading)

Mike Barry (JIRA | 20 Aug 15:40 2014
Picon

[jira] [Created] (LOG4NET-437) LogicalThreadContext data does not flow properly using Async and Await

Mike Barry created LOG4NET-437:
----------------------------------

             Summary: LogicalThreadContext data does not flow properly using Async and Await
                 Key: LOG4NET-437
                 URL: https://issues.apache.org/jira/browse/LOG4NET-437
             Project: Log4net
          Issue Type: Bug
          Components: Core
    Affects Versions: 1.2.13, 1.2.12, 1.2.11, 1.2.10, 1.2.9
         Environment: Windows 7, .NET 4.5
            Reporter: Mike Barry

LogicalThreadContext doesn't work properly when using Async and Await. The current NDC call stack gets
corrupted because the logical data context is not immutable. (See:
http://blog.stephencleary.com/2013/04/implicit-async-context-asynclocal.html for the gory
details). I've attached a Program.cs that demonstrates the issue. You will see with an unpatched log4net
the thread context is corrupted compared to the proper implementation in MyStack and the console logger.
An entry like:

LOG4NET Main 1 A 2 A: </MoreWork>
LOG4NET Main 1 A 2 A: </MoreWork>

is invalid and should not be possible in a properly working thread context.

--
This message was sent by Atlassian JIRA
(v6.2#6252)

(Continue reading)

Krzysztof L. (JIRA | 20 Aug 13:15 2014
Picon

[jira] [Commented] (LOG4NET-378) Rolling log file is overwritten when application is restarted


    [
https://issues.apache.org/jira/browse/LOG4NET-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14103761#comment-14103761
] 

Krzysztof L. commented on LOG4NET-378:
--------------------------------------

I have found another issue when using second appender configuration from my previous note (https://issues.apache.org/jira/browse/LOG4NET-378?focusedCommentId=14103641&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14103641)...

Problem from this ticket still occurs when using configuration like that:

{code:xml}
<appender name="mainAppender" type="log4net.Appender.RollingFileAppender">
  <file value="logs\Module_XYZ_" />

  <staticLogFileName value="false" />

  <appendToFile value="true" />

  <encoding>utf-8</encoding>

  <preserveLogFileNameExtension value="true"/>

  <rollingStyle value="Composite" />

  <datePattern value="''yyyy-MM-dd'.log'"/>

  <maxSizeRollBackups value="10" />

(Continue reading)

Krzysztof L. (JIRA | 20 Aug 10:54 2014
Picon

[jira] [Commented] (LOG4NET-378) Rolling log file is overwritten when application is restarted


    [
https://issues.apache.org/jira/browse/LOG4NET-378?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14103641#comment-14103641
] 

Krzysztof L. commented on LOG4NET-378:
--------------------------------------

Hello

Patch provided in commit (http://svn.apache.org/repos/asf/logging/log4net/trunk):
{quote}
Revision: 1486596
Author: dpsenner
Date: 27.05.2013 14:45:46
Message:
LOG4NET-378 fixed a problem where rolled log files get overwritten when the application is restarted

The cause is that InitializeFromOneFile() does not succesfully detect the filenames.
----
Modified : /logging/log4net/trunk/src/Appender/RollingFileAppender.cs
{quote}

works OK for configuration provided  in "Description" of this ticket. But it does NOT WORK in scenario when
datePattern has additional *uppercase* characters, eg:

bq. <datePattern value="'Module_XYZ_'yyyy-MM-dd'.log'"/>

I know that additional strings could be inserted to <file value=".../> but it would be nice if such
datePattern configuration is also supported, especially that the required code patch is not too
(Continue reading)


Gmane