首页 新闻 会员 周边

log4net配置问题

0
[已解决问题] 解决于 2013-10-22 23:01

每天就是一个文件夹,文件夹里面每个文件最大50MB,多个文件文件名这样:1.txt,2.txt,3.txt…………,应该怎么配

拖鞋王子的主页 拖鞋王子 | 初学一级 | 园豆:37
提问于:2013-05-28 10:44
< >
分享
最佳答案
0

没有简单办法 Rollingfile 要么指定文件大小 log文件都在一个目录中; 要么可以指定文件名, 让每天的log记录在一个文件中, 这时可以指定目录。 不可以又指定不同文件目录又指定大小。

可以为log4net写一个custom的FileAppender来实现。 http://stackoverflow.com/questions/2385669/how-i-can-set-log4net-to-log-my-files-into-different-folders-each-day 这个例子不错。

奖励园豆:5
gunsmoke | 老鸟四级 |园豆:3592 | 2013-05-29 05:21
其他回答(1)
-1

FILE *out;
char newname[256];
//newname即为你想创建的文件名
if((out = fopen(newname, "wb+"))  != NULL)
{

}

//创建文件夹
char newfoldername[256];
     SECURITY_ATTRIBUTES attribute;
        attribute.nLength = sizeof(attribute);
        attribute.lpSecurityDescriptor = NULL;
        attribute.bInheritHandle = FALSE;
        //创建
        if(CreateDirectoryA(newfoldername,&attribute) == 0)

安朵 | 园豆:129 (初学一级) | 2013-05-28 11:38
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册