vb.net - How do I programmatically determine the location of the VB application log? -


<'m Html>

I vb.net old to bring it in compliance with Elyue principles Vista application retro-fitting. So far, an obscure use of the logging mechanism has been used in the application, but a list has been written in the main one: c: \ temp \ if the folder is in existence. I want to change this current login with a more standard logging mechanism.

The being is VB, I decided to try to My.Application.Log use in conjunction with app.config, and work, Wherever it goes (though I did not expect to dump it in the roaming profile) Unfortunately, those logs have information, as well as when they submit a bug, and this log is running very well in the skins With the sending of logs are accustomed to troubleshooting.

To make my thought log, edit

in the app's UI, by adding a link to it, or at least a little more accessible to that folder, which is included in it (Add'l info):

My configuration file is at least the default:

& lt; System.diagnostics & gt; & Lt; Sources & gt; & Lt; Source Name = "Error Log" switchName = "DefaultSwitch" & gt; & Lt; Listeners & gt; & Lt; Add name = "FileLog" /> & Lt; / Listeners & gt; & Lt; / Source & gt; & Lt; / Sources & gt; & Lt; Switch & gt; & Lt; Add name = "default switch" value = "notification" /> & Lt; / Switch & gt; & Lt; SharedListeners & gt; & Lt; "Version = 8.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a, processorArchitecture = MSIL Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic" initializeData = "FileLogWriter" / & gt add name = "FileLog" type =; & Lt; / SharedListeners & gt; & Lt; /system.diagnostics>

I want to set some properties in the config file on FileLogTraceListener. MaxSize, e.g. (There was a maximum maximum-size behavior) I do not see any document that calls it, though. (Depending on the community is a community content which tells me that enabled me, so I will look into it. Although I may support some official documents for it, so I feel more comfortable.)

If I do, I My.Application.Log Mark listener collection and should be only able to link FullLogFileName first FileLogTraceListener.

I believe this is configurable. It can be configured in the machine.config file, or you can override your application in the config file - which you want to do so, so that you can control it and create a link for it.

Would you like to add a FileLogTraceListener to app.config.

Go to the system.diagnostics \ sharedListeners section. You can specify the file name in initializeData attribute

Documentation from more MSDN.


  • Comments