引用页面调用
using log4net;
//[assembly: log4net.Config.XmlConfigurator(Watch = true)]
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
namespace LogForOracle
{
public partial class _Default : System.Web.UI.Page
{
//创建日志记录组件实例
public static readonly ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
log.Error("写数据失败", new Exception("异常"));
log.Debug("编译错误",new Exception("越界"));
}
}
}
4.建表
create table LOG
(
DATETIME TIMESTAMP(3),
THREAD VARCHAR2(255),
LOG_LEVEL VARCHAR2(255),
LOGGER VARCHAR2(255),
MESSAGE VARCHAR2(4000)
)
posted @
2009-08-04 19:06
西门吹雪
阅读(
392)
评论()
编辑
收藏
举报