0

I have an application log4net implemented and running on Windows 8. When I run the application after loging in as local administrator the logs are being created; following are the log4net debug entry for it :

log4net: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]
log4net: configuring repository [log4net-default-repository] using file [.\Resources\Configuration\LoggerConfig.xml]
log4net: configuring repository [log4net-default-repository] using stream
log4net: loading XML configuration
log4net: Configuring Repository [log4net-default-repository]
log4net: Configuration update mode [Merge].

But when the application runs on another account it stops creating logs; the log4net debug info as follow :

log4net: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]
log4net: configuring repository [log4net-default-repository] using file [.\Resources\Configuration\LoggerConfig.xml]
log4net: config file [C:\Windows\system32\Resources\Configuration\LoggerConfig.xml] not found. Configuration unchanged.

I then right clicked on the exe of the application and from compatibility mode checked to run as administrator. Still no luck. Can anybody please suggest exactly what and where I need to check ?

marifrahman
  • 681
  • 2
  • 13
  • 31

1 Answers1

0

Looking at your error message:

log4net: config file [C:\Windows\system32\Resources\Configuration\LoggerConfig.xml] not found. Configuration unchanged.

Non-admin users do not have access to the system32 folder. I would suggest moving your configuration files (and any other resources for that matter) to a common folder for your application that is not in a otherwise restricted folder e.g. "C:\YourAppName\Resources\".

heathesh
  • 261
  • 1
  • 5
  • I have the config file in .\Resources\Configuration\LoggerConfig.xml - I am not actually sure why it is looking in the system folder !! – marifrahman Sep 09 '14 at 07:52
  • That indicates that the app is running from the system32 folder when you run it as another user. If it's trying to read ".\Resources\Configuration\LoggerConfig.xml" and ends up in system32, that's the problem. How are you running it when you run it as another user? Is it through the scheduler? Can you specify the start folder? – heathesh Sep 09 '14 at 08:05
  • Well, the application is at the root C:\myapp\myapp.exe; being run by a bat file starting on startup of the windows C:\logon.bat – marifrahman Sep 09 '14 at 09:46
  • In the batch file itself, maybe try changing the directory before running the exe e.g. "cd C:\myapp". – heathesh Sep 09 '14 at 10:01