TraceUser not working even though the log is opened?!

Post » Fri Jun 22, 2012 2:07 am

Hi. I'm having a seemingly weird issue with the TraceUser function. I open the log and everything goes smoothly, but when I try to write something to it, it always fails. Am I doing something wrong here or is this a files permission issue? I've searched my Skyrim folder and there was no \Logs\Script\User sub-folders. I created them and gave the skyrim directory full permissions but this didn't seem to solve the issue either.

PS: I'm running this code from a referenceAlias script on a quest that starts as soon as a save is loaded. Not that it should make any difference, but just thought I'd put that out there..

String asLogName = "userSessionLog"Event OnInit()If(Debug.OpenUserLog(asLogName))Debug.MessageBox("Opened the log..")ElseDebug.MessageBox("Did not open the log..")EndIfIf(Debug.TraceUser(asLogName, "some random info"))Debug.MessageBox("I just wrote to the sessionLog!")ElseDebug.MessageBox("Could not write to sessionLog.")EndIfDebug.CloseUserLog(asLogName)EndEvent
User avatar
Prue
 
Posts: 3425
Joined: Sun Feb 11, 2007 4:27 am

Post » Thu Jun 21, 2012 12:38 pm

My user logs are also failing after the Creation Kit update.

Previously I could write logging entries into the Papyrus logs and my own custom log with the following code:-

Spoiler
Scriptname MintyLogging extends Quest{ Provides logging/debugging/feedback functionality }import debugimport GameGlobalVariable Property MintyLoggingEnabled AutoGlobalVariable Property MintyFeedBackEnabled AutoGlobalVariable Property MintyVersion AutoString Property LogFileName = "Minty" Autoint YES = 1int NO = 0int LOG_LEVEL_INFO = 0int LOG_LEVEL_WARN = 1int LOG_LEVEL_ERROR = 2Event OnInit()OpenUserLog(LogFileName)TraceUser(LogFileName, LogFileName + " : (Version:" + getVersion() + ") Log file created.")EndEventFunction Debug(String msg)if (isLoggingEnabled())   TraceUser(LogFileName, GetFormID() + " : " + msg)endifEndFunctionFunction Info(String msg)Debug(msg)if (isFeedbackEnabled())  Notification(msg)endifEndFunctionFunction Warn(String msg)Info(msg)TraceStack("!WARN:" + msg, LOG_LEVEL_WARN)EndFunctionFunction Error(String msg)Warn(msg)TraceAndBox("!ERROR:" + msg, LOG_LEVEL_ERROR)EndFunctionFloat Function getVersion()return MintyVersion.getValue() as FloatEndFunctionFunction enableLogging()MintyLoggingEnabled.setValue(YES)EndFunctionFunction disableLogging()MintyLoggingEnabled.setValue(NO)EndFunctionbool Function isLoggingEnabled()return MintyLoggingEnabled.getValue() as boolEndFunctionFunction enableFeedback()MintyFeedBackEnabled.setValue(YES)EndFunctionFunction disableFeedback()MintyFeedBackEnabled.setValue(NO)EndFunctionbool Function isFeedbackEnabled()return MintyFeedBackEnabled.getValue() as boolEndFunction

and depending on my logging level I would either see entries within my custom log or within papyrus logs. Now I only see the papyrus log located in:-

C:\Users\Minty\Documents\My Games\Skyrim\Logs\Script

Has the user logging functionality been removed or has the user log file location been moved?
User avatar
mimi_lys
 
Posts: 3514
Joined: Mon Apr 09, 2007 11:17 am

Post » Fri Jun 22, 2012 12:12 am

After fiddling for a while with the windows folder permissions (though maybe that was preventing skyrim from writing anything to the filesystem) I found out that maybe via a CK or Skyrim update, some ini files were changed. Changing the logging flags back to 1 on the ini files located at the steam/steam apps/commom/skyrim folder and the my games/skyrim folder solved my issues! Hope it helps :cool:

On a side note, I can't seem to write stuff to the user log outside of the script that opened it.. I though it was supposed to be global?! Do I have to import the script that opened the log?! That makes no sense to me.. :confused:
User avatar
GPMG
 
Posts: 3507
Joined: Sat Sep 15, 2007 10:55 am

Post » Thu Jun 21, 2012 8:01 pm

Importing a scripts only allows you to call global functions declared in it without prefixing them, so that won't be the issue. It's entirely possible that opening a log file is local to a single script.

If you want it to be global, you could make a library script containing global functions that you then use to manipulate your log.

Cipscis
User avatar
Theodore Walling
 
Posts: 3420
Joined: Sat Jun 02, 2007 12:48 pm


Return to V - Skyrim