Updates to NLog

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Updates to NLog

Jarek Kowalski
Administrator
Hi!

I've recently made a number of small (well, most of them) changes to
NLog, which are supposed to ensure post-1.0 API stability and
extensibility and clean-up some messy code. Some new features have also
been added (full list below).

They are included in 20060803 snapshot:

http://www.nlog-project.org/snapshots/

Because of the number of changes this snapshot is not recommended for
production use.
Please give this snapshot a special testing to ensure no regressions
have been introduced. Pay attention to XML file parsing as some
significant changes have been made there.

I'm awaiting your feedback.

ChangeLog follows:

    * Added ${file-contents} layout renderer which inserts file contents.
    * Added [DefaultParameter] attribute which allows for nameless
parameters
    to layout renderers:

    ${aspnet-application}
    ${aspnet-request}
    ${aspnet-session}
    ${date}
    ${environment}
    ${file-contents}
    ${gdc}
    ${mdc}
    ${process-info}
    ${special-folder}
    ${asp-application}
    ${asp-request}
    ${asp-session}

    * Added ILayoutWithHeaderAndFooter.cs for layouts that support
    header/footer (such as CSV Layout, more to come)
    * The following targets have been enhanced to support headers/footers:

    Console
    ColoredConsole
    Debugger

    * Added NLogConfigurationException which is thrown instead of CLR
    exceptions when the configuration fails
    * Simplified XmlLoggingConfiguration by splitting large methods and
moving
    common functionality to PropertyHelper
    * Added Layouts/LayoutWithHeaderAndFooter.cs and
    TargetWithLayoutHeaderAndFooter.cs
    * Added MailTarget.AddNewLines to insert new lines between
    header/lines/footer
    * Added PopulateLayouts() method to ILayout
    * BREAKING CHANGE: Changed the default value of
    FileTarget.OpenFileCacheTimeout to -1
    * Added support for nested layout renderers. Used in ${file-contents}

    ${file-contents:fileName=${basedir}/aaa.txt}

    This required a large rewrite of the parsing engine. Hopefully the
test cases
    cover all possible situations.
    * Removed LogEventInfo.Empty and replaced with
    LogEventInfo.CreateNullEvent()
    * Added CsvLayout.WithHeader which can be used to disable CSV header.
    * Added VJSharp and Web item templates. Updated the installer to support
    VWD Express 2005.
    * Enhanced XSD Schema generation by properly generating abstract and
    layout properties.
    * Some more unit tests.

--
Jarek Kowalski
http://blog.jkowalski.net
http://www.nlog-project.org/ - A .NET Logging Library



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
NLog Blog
Reply | Threaded
Open this post in threaded view
|

Re: Updates to NLog

Ron Grabowski
I think users might find hash Layouts useful:

 ${crc32=${mdc:item=AccountNumber}}
 ${md5=${mdc:item=AccountNumber}}
 ${sha1=${mdc:item=AccountNumber}}
 ${hashCode=${mdc:item=AccountNumber}}

// untested
[LayoutRenderer("md5")]
public class MD5HashLayout : LayoutRenderer
{
 private Layout _item;

 [RequiredParameter]
 [DefaultParameter]
 public Layout Item
 {
  get { return _item; }
  set { _item = value; }
 }

 protected internal override int GetEstimatedBufferSize(LogEventInfo
logEvent)
 {
  return 32;
 }

 protected internal override void Append(StringBuilder builder,
LogEventInfo logEvent)
 {
  string md5hash =
FormsAuthentication.HashPasswordForStoringInConfigFile(
   _item.GetFormattedMessage(logEvent), "md5");
  builder.Append(ApplyPadding(md5hash));
 }
}

--- Jaroslaw Kowalski <[hidden email]> wrote:

>     * Added support for nested layout renderers. Used in
> ${file-contents}
>
>     ${file-contents:fileName=${basedir}/aaa.txt}

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
Reply | Threaded
Open this post in threaded view
|

Re: Updates to NLog

Jarek Kowalski
Administrator
Ron Grabowski wrote:
> I think users might find hash Layouts useful:
>
>  ${crc32=${mdc:item=AccountNumber}}
>  ${md5=${mdc:item=AccountNumber}}
>  ${sha1=${mdc:item=AccountNumber}}
>  ${hashCode=${mdc:item=AccountNumber}}
>  
Yes, that's the planned improvement path:

More ideas:

${rot13}
${substring:text=...:start=...:length=...}
${decrypt:algorithm=DES:key=${file-contents:keyfile.txt}:ciphertext=A14b2/123asd==}
${if:condition=...:whenTrue=...:whenFalse=...}
${replace:searchFor=....;replaceWith=...:regex=true}
${trim}
${translate} # tr/ABC/abc/
${cache:timeToLive=12:${file-contents:keyfile.txt}} # cache the results
of ${file-contents} and reload the file every 12 seconds

Jarek


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
NLog Blog