Robin Kluth wrote:
>
> I use Python 2.7 on win10 and pywin32 223. I want to log messqages to
> the EventLog:
>
> dllname = os.path.dirname(__file__)
> ntl = NTEventLogHandler("Python Logging Test", dllname=dllname)
> logger = logging.getLogger("")
> logger.setLevel(logging.DEBUG)
> logger.addHandler(ntl)
>
> logger.error("This is a '%s' message", "Error")
>
> But I get:
> ...
> pywintypes.error: (5, 'RegSetValueEx', 'Zugriff verweigert')
>
> If I run the script with Admin privs, it is working.
>
> How to log as "normal" user? Am I missing something?

You can't.  If you want to log to the event log, you'll need
privileges.  Each app must register as an "event source".  Doing so
requires writing to the HKEY_LOCAL_MACHINE part of the registry, and
write requires admin privileges.

Technically speaking, it would be possible to register that source once
in an elevated process and then use it without re-registering, but the
current code does not support that.

-- 
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32@python.org
https://mail.python.org/mailman/listinfo/python-win32

Reply via email to