log4net - sitecore logging (Sitecore.Diagnostics.Log.Error) and Log record GUID -


i have question sitecore logging: when unexpected error happen want return user unique ticket id, when user email error found logging database.

i've added activity_id parameter sql appender :

<param name="parameter">         <param name="parametername" value="@activity_id"/>         <param name="dbtype" value="string"/>         <param name="size" value="400"/>         <param name="layout" type="log4net.layout.patternlayout">           <param name="conversionpattern" value="%p{activityid}"/>         </param>       </param> 

now, need add activityid. :

private void application_start() { ...     httpcontext.current.items.add("activityid", guid.newguid().tostring()) 

how can sitecore logging ? can use:

sitecore.diagnostics.log.error("error happen", this);

update: i've added following code global.asax.cs , , value still empty.

public class global : sitecore.web.application     {          protected void application_start(object sender, eventargs e)         {                            log4net.mdc.set("activityid", guid.newguid().tostring("d"));         } 

sitecore logging based on log4net. idea transfer value log4net context. can try:

log4net.mdc.set("activityid", "value"); 

from sitecore.logging assembley


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -