Return-Path: X-Original-To: apmail-logging-log4net-dev-archive@www.apache.org Delivered-To: apmail-logging-log4net-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BE2EA107BB for ; Fri, 26 Jul 2013 13:38:51 +0000 (UTC) Received: (qmail 28745 invoked by uid 500); 26 Jul 2013 13:38:51 -0000 Delivered-To: apmail-logging-log4net-dev-archive@logging.apache.org Received: (qmail 28596 invoked by uid 500); 26 Jul 2013 13:38:46 -0000 Mailing-List: contact log4net-dev-help@logging.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Log4NET Dev" List-Id: Delivered-To: mailing list log4net-dev@logging.apache.org Received: (qmail 28582 invoked by uid 99); 26 Jul 2013 13:38:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jul 2013 13:38:44 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of phowe@paychex.com designates 141.123.120.33 as permitted sender) Received: from [141.123.120.33] (HELO mailin11.paychex.com) (141.123.120.33) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Jul 2013 13:38:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=paychex.com; s=032013.paychex.com; c=relaxed/simple; q=dns/txt; i=@paychex.com; t=1374845895; x=1406381895; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iXsVUxdfRKYcZTWThl/qsGPkx65zx3VVEuzFwCyobnc=; b=gBKKbPUwEty3AcDAJZKqPVeJaknxQj9WaQinC2+0iq6We0hlTjBUgFvQ2pF/B4Ty ciaXoQK6o9V2/7wZWfYtWfn1pMfL23XWeG9l0o0xRXunKWrSJQEWu9HhCKrI3mJE T2DZiuq2gUPyqpsW+OHe7WbWIdn2oMM7RJtw6M/Olfw=; X-AuditID: ac107826-b7fde8e0000009af-0c-51f27bc7347b X-Server-Uuid: 49D65966-0291-4C37-B670-18BEA6276F97 From: "Howe, Peter L" To: "Log4NET Dev" Date: Fri, 26 Jul 2013 09:38:08 -0400 Subject: RE: File naming Thread-Topic: File naming Thread-Index: AQIae16Swc5+IdXnHVP3PWLuk8z2TAGnf182AqzUsQCYumBtkIACDzfQ Message-ID: References: <003001ce887d$b0c6ef40$1254cdc0$@gmail.com> <002b01ce88ff$67199190$354cb4b0$@gmail.com> In-Reply-To: <002b01ce88ff$67199190$354cb4b0$@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-WSS-ID: 7DECA44B1142773916-01-01 Content-Type: multipart/alternative; boundary=_000_F1864A8DC815BB47AA000B23833CC9136C9D4B8CACEXCHWEB1paych_ X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDKsWRmVeSWpSXmKPExsXCxXSDTfd49adAg719Qharvx1hc2D0aLq+ jz2AMaqB0SYxLy+/JLEkVSEltTjZVikgsTI5I7VCwTe1uDgxPVUhuCQxt0BJITPFVslISaEg JzE5NTc1r8RWKbGgIDUvRcmOSwED2ACVZeYppOYl56dk5qXbKnkG++taWJha6hoq2YVkpCpk 5qXlF+UmlmTm5yUsZM3YtauNqeD4WcaKmVOXMDYwXt3J2MXIySEhYCLx+/MJdghbTOLCvfVs ELaxxOv7B8Fq2AQ0JZYc+8AKYosIGEkc71/DAmKzCKhKzF7+DaxXWEBC4vaKDcwQNZISp858 YIew3SR+zJ8CNpNXwFdiZedPoJlcHEICbxkljvUdAiviFLCQ2LuqG2woI9AR30+tYQKxmQXE JW49mc8EcZCgxKLZe5hhDv236yEbRL2oxJ329YwQCwQlTs58wgJRoyRx+O12dog5uRKzz55j mcAoMgvJ2FlIWmYhKYOwdSQaPi1mgrC1JZYtfM08i5EDzG5bpIAsvICRfRWjSG5iZk5mnqGh XgEkbvWS83M3MQJTxhqBCrUdjI3bVQ8xCnAwKvHwOnz5GCjEmlhWXJl7iFGCg1lJhPe696dA Id6UxMqq1KL8+KLSnNTiQ4ymwACeyCwlmpwPTGd5JfGGRhaGluYWZuZGRqbmSuK8L9UmBgoJ pANTVXZqakFqEUwfEwenVAMjw8WstFBnvZqNEpOOOeeq3fzD5bliYja7K+ss3h8TUnZfMle6 4ngtSibcY2G34oQ7iTwdx00M9df9aXh/9M6dze99n+5IikxmvnTFN9vjZRbH1UBrXTtDJdkP 3z3rGJSnrbs1+fOi8ydPuisrSCztes51Yd/kW3y9e1P3Ji1WTp1o9e9N55pNSizFGYmGWsxF xYkAHzAJyy8DAAA= X-Virus-Checked: Checked by ClamAV on apache.org --_000_F1864A8DC815BB47AA000B23833CC9136C9D4B8CACEXCHWEB1paych_ Content-Type: text/plain; charset=us-ascii content-transfer-encoding: quoted-printable I'm almost there, but I don't know enough about the code to see if it would= roll properly. With this configuration: I get files that are named like: 20130726_6600_26_MyApplication.log 20130726_6744_26_MyApplication.log etc. I had to leave the "dd" in the datePattern so it had something to roll on, b= ut I have not tried running the test application overnight to see what reall= y happens at midnight... Peter From: Dominik Psenner [mailto:dpsenner@gmail.com] Sent: Thursday, July 25, 2013 2:23 AM To: 'Log4NET Dev' Subject: AW: File naming You found a workaround. Interesting. :) However, you won't get the date as a= prefix for %processid. I'm posting the code responsible for calculating the= filename in the RollingFileAppender which should explain why what's the cas= e: --- QUOTE --- protected string GetNextOutputFileName(string fileName) { if (!m_staticLogFileName) { fileName =3D fileName.Trim(); if (m_rollDate) { fileName =3D CombinePath(fileName, m_now.ToString(m_datePattern, System.Glob= alization.DateTimeFormatInfo.InvariantInfo)); } if (m_countDirection >=3D 0) { fileName =3D CombinePath(fileName, "." + m_curSizeRollBackups); } } return fileName; } --- /QUOTE --- where CombinePath behaves like this: --- QUOTE --- private string CombinePath(string path1, string path2) { string extension =3D Path.GetExtension(path1); if (m_preserveLogFileNameExtension && extension.Length > 0) { return Path.Combine(Path.GetDirectoryName(path1), Path.GetFi= leNameWithoutExtension(path1) + path2 + extension); } else { return path1 + path2; } } --- /QUOTE --- Therefore there are various restrictions involved with how and where the dat= e can be put into the filename. Currently there's no way of changing this since any way to improve this woul= d require to change the public API (the way the RFA is configured) and thus= we will try to fix that filename trouble once and for all with the rewrite= of the RollingFileAppender. I can imagine that there won't be a configuration anymore, but everything will be put into the tag whe= re one will be able to use something like %date{format}. At least that's wha= t I believe would be the best since that allows people to put the date porti= on into directory names which was often requested but so far has been imposs= ible to do. And that way we allow even fancier stuff to happen in the = tag. :) Even though this will complicate the rolling significantly and ther= e are a lot of cases that need to be taken care of. Cheers The information contained in this message may be privileged, confidential an= d protected from disclosure. If the reader of this message is not the intend= ed recipient, or an employee or agent responsible for delivering this messag= e to the intended recipient, you are hereby notified that any dissemination,= distribution or copying of this communication is strictly prohibited. If yo= u have received this communication in error, please notify your representati= ve immediately and delete this message from your computer. Thank you. --_000_F1864A8DC815BB47AA000B23833CC9136C9D4B8CACEXCHWEB1paych_ Content-Type: text/html; charset=us-ascii content-transfer-encoding: quoted-printable

 

I’m almost there, but I don’t know enough about t= he code to see if it would roll properly.  With this configuration:

&n= bsp;

     <file type=3D&qu= ot;log4net.Util.PatternString"

      &nb= sp;    value=3D"C:\temp\logs\%date{yyyyMMdd}_%processid_" /> 

 

&n= bsp;     <staticLo= gFileName val= ue=3D"= false"= /><= /o:p>

      <appendToFile value=3D"true"/>

      <rollingStyle <= span style=3D'font-size:9.5pt;font-family:Consolas;color:red;background:whit= e;mso-highlight:white'>value=3D"Date"/>

 

      <= ;datePattern value=3D<= /span>"dd'_My= Application.log'"/>    

 

I get files that are named like:

 =

20130726= _6600_26_MyApplication.log

20130726_6744_26_MyApplication.log<= /p>

etc.=

 

I had to leave the= “dd” in the datePattern so it had something to roll on, but I h= ave not tried running the test application overnight to see what really happ= ens at midnight…

 

Peter

 

 

 

 

 

From: Dominik Psenner [mailto:dpsenner@gmail.com]
= Sent: Thursday, July 25, 2013 2:23 AM
To: 'Log4NET Dev'
= Subject: AW: File naming

 

You found a workaround. Interesting. J However, you won’t get the date as a prefix= for %processid. I’m posting the code responsible for calculating the= filename in the RollingFileAppender which should explain why what’s t= he case:

 

--- QUOTE ---

protected string G= etNextOutputFileName(string fileName)

{

   =              if= (!m_staticLogFileName)

       =          {

  &nbs= p;            &n= bsp;            =    fileName =3D fileName.Trim();

    =             &nbs= p;            &n= bsp; if (m_rollDate)

       &nbs= p;            &n= bsp;          {

<= span lang=3DEN-GB style=3D'color:#1F497D'>fileName =3D CombinePath(fileName,= m_now.ToString(m_datePattern, System.Globalization.DateTimeFormatInfo.Invar= iantInfo));

         &= nbsp;            = ;         }

 

            &n= bsp;            =       if (m_countDirection >=3D 0)

&nb= sp;            &= nbsp;            = ;     {

fileName =3D CombinePath(fileName, "." + m_curSizeRollBa= ckups);

         &nb= sp;             =          }

  &nbs= p;             }=

           =      return fileName;

}

--- /QUOTE ---=

 

where CombinePath behaves like this:

 

--- QUOTE ---

       = ; private string CombinePath(string path1, string path2)

 &nbs= p;      {

     &n= bsp;      string extension =3D Path.GetExtension(pa= th1);

          &= nbsp; if (m_preserveLogFileNameExtension && extension.Length > 0)=

            = ;{

          &nbs= p;     return Path.Combine(Path.GetDirectoryName(path1),= Path.GetFileNameWithoutExtension(path1) + path2 + extension);

&nbs= p;           }<= /span>

&n= bsp;           else

            {=

            = ;    return path1 + path2;

    &= nbsp;       }

    = ;    }

--- /QUOTE ---

 

The= refore there are various restrictions involved with how and where the date c= an be put into the filename.

 

Currently there̵= 7;s no way of changing this since any way to improve this would require to c= hange the public API (the way the RFA is configured) and thus we will try to= fix that filename trouble once and for all with the rewrite of the RollingF= ileAppender. I can imagine that there won’t be a <datePattern> c= onfiguration anymore, but everything will be put into the <file> tag w= here one will be able to use something like %date{format}. At least thatR= 17;s what I believe would be the best since that allows people to put the da= te portion into directory names which was often requested but so far has bee= n impossible to do. And that way we allow even fancier stuff to happen in th= e <file> tag. J Even tho= ugh this will complicate the rolling significantly and there are a lot of ca= ses that need to be taken care of.

 

Cheers

The i= nformation contained in this message may be privileged, confidential and pro= tected from disclosure. If the reader of this message is not the intended re= cipient, or an employee or agent responsible for delivering this message to= the intended recipient, you are hereby notified that any dissemination, dis= tribution or copying of this communication is strictly prohibited. If you ha= ve received this communication in error, please notify your representative i= mmediately and delete this message from your computer. Thank you.

--_000_F1864A8DC815BB47AA000B23833CC9136C9D4B8CACEXCHWEB1paych_--