Code Coverage by Clover.NET

Encryption

View: New views
4 Messages — Rating Filter:   Alert me  

Encryption

by NLog Convert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I recently switched to NLog from Log4Net and love it.  I have a question regarding how to extend some behavior...  The big bosses require that we log events to a normal database table AND to a second table where the message and potentially Level, etc. are encrypted.  What is the best way to do this with NLog?

It seems that the cleanest way would be to have an "EncryptionTargetWrapper".
So I would have two out-of-the-box targets of type Database.  The first would be for the normal log table.  I could then wrap the second Database target with the EncryptionTargetWrapper.  (I would have the database trigger just do the encryption for me upon an insert into the normal table, but this is very slow.)
Do you have any plans to provide an encryption wrapper in the future?

Thanks,

Tyler

Re: Encryption

by Jaroslaw_Kowalski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't think this can be done in a wrapper, but feel free to experiment.
You might need to turn some private/internal function into "public", but
since we are pre-1.0 this is something that can still be done.

Depending on your exact requirements I'd either:

- write an extension to the Database target where you mangle the SQL string
before sending it out.
- write your own set of layout renderers, like

${encrypted-message}
${encrypted-level}

I'd personally prefer the latter approach as it is much cleaner.

Jarek

----- Original Message -----
From: "NLog Convert" <Tyler_Wilson@...>
To: <nlog-list@...>
Sent: Saturday, May 27, 2006 2:15 AM
Subject: [Nlog-list] Encryption


>
> Hi,
>
> I recently switched to NLog from Log4Net and love it.  I have a question
> regarding how to extend some behavior...  The big bosses require that we
> log
> events to a normal database table AND to a second table where the message
> and potentially Level, etc. are encrypted.  What is the best way to do
> this
> with NLog?
>
> It seems that the cleanest way would be to have an
> "EncryptionTargetWrapper".
> So I would have two out-of-the-box targets of type Database.  The first
> would be for the normal log table.  I could then wrap the second Database
> target with the EncryptionTargetWrapper.  (I would have the database
> trigger
> just do the encryption for me upon an insert into the normal table, but
> this
> is very slow.)
> Do you have any plans to provide an encryption wrapper in the future?
>
> Thanks,
>
> Tyler
> --
> View this message in context:
> http://www.nabble.com/Encryption-t1689853s6167.html#a4585691
> Sent from the NLog-list forum at Nabble.com.
>
>
>
> -------------------------------------------------------
> All the advantages of Linux Managed Hosting--Without the Cost and Risk!
> Fully trained technicians. The highest number of Red Hat certifications in
> the hosting industry. Fanatical Support. Click to learn more
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
> _______________________________________________
> Nlog-list mailing list
> Nlog-list@...
> https://lists.sourceforge.net/lists/listinfo/nlog-list
>



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Nlog-list mailing list
Nlog-list@...
https://lists.sourceforge.net/lists/listinfo/nlog-list

Parent Message unknown Re: Encryption

by Jaroslaw_Kowalski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The bug is probably a typo: you have "assembyFile" instead of
"assemblyFile".

Alternatively use <add assembly="Logger" /> to rely on .NET probing
mechanism.

Jarek
----- Original Message -----
From: "Wilson, Tyler" <Tyler_Wilson@...>
To: "Jaroslaw Kowalski" <jaak@...>
Sent: Tuesday, May 30, 2006 10:54 PM
Subject: RE: [Nlog-list] Encryption


> Hi Jarek,
>
> Thanks for the reply.
>
> I've actually chosen to just do a simple Target.  However, I'm running
> into what appears to be a bug:  The assembly and assemblyFile attribute
> values don't seem to be read.  I'm using the latest NLog.
>
>  <extensions>
>    <add assembyFile="Logger.dll"/>
>  </extensions>
>
> When I programmatically add the target, it works:
> TargetFactory.AddTarget("EncrypterTarget", typeof(EncrypterTarget));
>
> Here's the full config file:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <nlog autoReload="true" internalLogToConsole="false">
>  <extensions>
>    <add assembyFile="Logger.dll"/>
>  </extensions>
>  <targets>
>    <target name="ConsoleTarget" type="Console"
>      <!-- Encrypts log message, writes to database -->
>      <target name="EncrypterTarget" type="EncrypterTarget"
> host="localhost"/>
>  </targets>
>
>  <rules>
>   <logger name="*" minlevel="Info" appendTo="EncrypterTarget" />
>  </rules>
> </nlog>
>
> Is this a known bug?
>
> Tyler
>
>
>
>
> ---
>
> Tyler Wilson
> Sr. Engineer
>
> Email: Tyler_Wilson@...
> Office: 360 314 1853
> Mobile: otherMobile
> Fax: 360 314 1890
>
> Xiotech Corporation
> 5701 SE Columbia WaySuite 200
> Vancouver, WA 98661
>
> www.xiotech.com : www.xiotech.com/demo : Toll-Free 866 472 6764
>
> -----Original Message-----
> From: Jaroslaw Kowalski [mailto:jaak@...]
> Sent: Friday, May 26, 2006 9:13 PM
> To: Wilson, Tyler; nlog-list@...
> Subject: Re: [Nlog-list] Encryption
>
> I don't think this can be done in a wrapper, but feel free to
> experiment.
> You might need to turn some private/internal function into "public", but
>
> since we are pre-1.0 this is something that can still be done.
>
> Depending on your exact requirements I'd either:
>
> - write an extension to the Database target where you mangle the SQL
> string
> before sending it out.
> - write your own set of layout renderers, like
>
> ${encrypted-message}
> ${encrypted-level}
>
> I'd personally prefer the latter approach as it is much cleaner.
>
> Jarek
>
> ----- Original Message -----
> From: "NLog Convert" <Tyler_Wilson@...>
> To: <nlog-list@...>
> Sent: Saturday, May 27, 2006 2:15 AM
> Subject: [Nlog-list] Encryption
>
>
>>
>> Hi,
>>
>> I recently switched to NLog from Log4Net and love it.  I have a
> question
>> regarding how to extend some behavior...  The big bosses require that
> we
>> log
>> events to a normal database table AND to a second table where the
> message
>> and potentially Level, etc. are encrypted.  What is the best way to do
>
>> this
>> with NLog?
>>
>> It seems that the cleanest way would be to have an
>> "EncryptionTargetWrapper".
>> So I would have two out-of-the-box targets of type Database.  The
> first
>> would be for the normal log table.  I could then wrap the second
> Database
>> target with the EncryptionTargetWrapper.  (I would have the database
>> trigger
>> just do the encryption for me upon an insert into the normal table,
> but
>> this
>> is very slow.)
>> Do you have any plans to provide an encryption wrapper in the future?
>>
>> Thanks,
>>
>> Tyler
>> --
>> View this message in context:
>> http://www.nabble.com/Encryption-t1689853s6167.html#a4585691
>> Sent from the NLog-list forum at Nabble.com.
>>
>>
>>
>> -------------------------------------------------------
>> All the advantages of Linux Managed Hosting--Without the Cost and
> Risk!
>> Fully trained technicians. The highest number of Red Hat
> certifications in
>> the hosting industry. Fanatical Support. Click to learn more
>>
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
>> _______________________________________________
>> Nlog-list mailing list
>> Nlog-list@...
>> https://lists.sourceforge.net/lists/listinfo/nlog-list
>>
>



-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Nlog-list mailing list
Nlog-list@...
https://lists.sourceforge.net/lists/listinfo/nlog-list

Two apps, one log file

by NLog Convert :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi, I have a standalone app and a web site running on the same machine
and I would like both to write to the same log file.  The ${basedir}
locations are different.  How can I set the paths using an environment
variable?
The following doesn't work (at least in version 0.9.5.0):

<target name="RollingFileTarget"
        type="File"
        ...
        filename="${MY_ENV_VAR}\log\MyLog.log"
 
archiveFileName="${MY_ENV_VAR}\log\Archives\MyLog.{########}.log"
        ...
/>


---

Tyler Wilson
Sr. Engineer

Email: Tyler_Wilson@...
Office: 360 314 1853
Mobile: otherMobile
Fax: 360 314 1890

Xiotech Corporation
5701 SE Columbia WaySuite 200
Vancouver, WA 98661

www.xiotech.com : www.xiotech.com/demo : Toll-Free 866 472 6764

-------------------------------------------------------------------------
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
Nlog-list@...
https://lists.sourceforge.net/lists/listinfo/nlog-list
LightInTheBox - Buy quality products at wholesale price