0

I am trying to use this pattern to create a dynamic file name: "Debug_%property{LogUserName}.txt"

The value of %property{LogUserName} is retrieved from log4net.LogicalThreadContext.Properties["LogUserName"], which is filled when the user logs in.

In the first time, it works perfectly. The file gets named like Debug_user1.txt (for example).

If user1 disconnects, and the user2 logs in (at the same browser) a new file should be created, but it's not happening.

It seems that the LogicalThreadContext.Properties are final variables, and can't be changed at runtime.

I tried to change the FileAppender.File property, but it doesn't work too.

4

1 回答 1

0

用 stuartd 的提示解决了这个问题:调用 ActivateOptions()。

于 2013-10-23T14:25:41.223 回答