Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void Application_PostAcquireRequestState(object sender, EventArgs e)
- {
- log4net.ThreadContext.Properties["SessionID"] = Session.SessionID;
- }
- protected void Application_PostAcquireRequestState(object sender, EventArgs e)
- {
- if (Context.Handler is IRequiresSessionState)
- {
- log4net.ThreadContext.Properties["SessionId"] = Session.SessionID;
- }
- }
- private void AcquireRequestState(Object source, EventArgs e)
- {
- HttpApplication application = (HttpApplication)source;
- HttpContext context = application.Context;
- log4net.ThreadContext.Properties["SessionId"] = context.Session.SessionID;
- }
- <appender name="rollingFile"
- type="log4net.Appender.RollingFileAppender,log4net" >
- <param name="AppendToFile" value="false" />
- <param name="RollingStyle" value="Date" />
- <param name="DatePattern" value="yyyy.MM.dd" />
- <param name="StaticLogFileName" value="true" />
- <param name="File" value="log.txt" />
- <layout type="log4net.Layout.PatternLayout,log4net">
- <param name="ConversionPattern"
- value="%property{SessionId} %d [%t] %-5p %c - %m%n" />
- </layout>
- </appender>
- <conversionPattern
- value="%date %-5level %logger ${COMPUTERNAME} [%property{SessionID}] - %message%newline" />
- protected void Session_Start(object sender, EventArgs e)
- {
- log4net.ThreadContext.Properties["SessionID"] = Session.SessionID;
- log4net.Config.XmlConfigurator.Configure();
- }
Add Comment
Please, Sign In to add comment