作者:未知 标签:乱贴

4671天前 (阅读:147407)

1、建表

CREATE TABLE [dbo].[Log] (
 [Id] [int] IDENTITY (1, 1) NOT NULL,
 [Date] [datetime] NOT NULL,
 [Thread] [varchar] (255) NOT NULL,
 [Level] [varchar] (50) NOT NULL,
 [Logger] [varchar] (255) NOT NULL,
 [Message] [varchar] (4000) NOT NULL,
 [Exception] [varchar] (2000) NULL
)


2、配置
<appender name="ADONetAppender" type="log4net.Appender.ADONetAppender">
 <bufferSize value="100" />
 <connectionType value="System.Data.SqlClient.SqlConnection,
System.Data, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
 <connectionString value="data source=[database server];initial
catalog=[database name];integrated security=false;persist security
info=True;User ID=[user];Password=[password]" />
 <commandText value="INSERT INTO Log
([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES
(@log_date, @thread, @log_level, @logger, @message, @exception)" />
 <parameter>
  <parameterName value="@log_date" />
  <dbType value="DateTime" />
  <layout type="log4net.Layout.RawTimeStampLayout" />
 </parameter>
 <parameter>
  <parameterName value="@thread" />
  <dbType value="String" />
  <size value="255" />
  <layout type="log4net.Layout.PatternLayout">
   <conversionPattern value="%thread" />
  </layout>
 </parameter>
 <parameter>
 <parameterName value="@log_level" />
  <dbType value="String" />
  <size value="50" />
  <layout type="log4net.Layout.PatternLayout">
   <conversionPattern value="%level" />
  </layout>
 </parameter>
 <parameter>
  <parameterName value="@logger" />
  <dbType value="String" />
  <size value="255" />
  <layout type="log4net.Layout.PatternLayout">
   <conversionPattern value="%logger" />
  </layout>
 </parameter>
 <parameter>
  <parameterName value="@message" />
  <dbType value="String" />
  <size value="4000" />
  <layout type="log4net.Layout.PatternLayout">
   <conversionPattern value="%message" />
  </layout>
 </parameter>
 <parameter>
  <parameterName value="@exception" />
  <dbType value="String" />
  <size value="2000" />
  <layout type="log4net.Layout.ExceptionLayout" />
 </parameter>
</appender>


06.09.2012 в 10:55Вам нужно вместо метода rdeenr($(非注册用户) 2014-3-28 11:15:00

06.09.2012 в 10:55Вам нужно вместо метода rdeenr($view, $data) использовать метод rdeenrPartial($view, $data).Например так:public function actionSome(){  $data = 'Some data';  echo $this->renderPartial($this->action->id, compact('data'));}

06.09.2012 в 10:55Вам нужно вместо метода rdeenr($(非注册用户) 2014-3-28 11:16:20

06.09.2012 в 10:55Вам нужно вместо метода rdeenr($view, $data) использовать метод rdeenrPartial($view, $data).Например так:public function actionSome(){  $data = 'Some data';  echo $this->renderPartial($this->action->id, compact('data'));}