| Home Page | Recent Changes | Preferences


UT2003 :: Object >> Actor >> Info >> FileLog (Package: Engine)

FileLog lets you write to an independant log file (rather than the normal UT2003.log). From what I gather, its usage is simple:

  1. Create an instance of FileLog.
  2. Call OpenLog() on the instance to open the log file with a filename (minus extension) you specify - the file will be placed in the "User Logs" folder with a .log extension
  3. Write to the log using Logf(String)
  4. Close the log using CloseLog()


pointer LogAr
Internal pointer to the file archive. You can't do anything with this.
string LogFileName
The filename used, this will be set after the call to OpenLog().


Native Functions

CloseLog ( )
Close the log file.
Logf (string LogString)
Write the string LogString to the opened file.
OpenLog (string FName)
Open a log file with the filename as defined by FName. Note: the filename can only contain alphanumeric characters and a few symbols. The following symbols will be converted to an '_': ':', '\', '/', '.'
The extention '.log' will always be appended to the filename, and the files will be saved in the ../UserLogs directory.


Destroyed ( )
This will automatically close the log file.


The output is buffered, that means nothing will be flushed to the actual log file until the buffer is full. So when the server shuts down without the FileLog being closed the log file will not contain the last few log lines.

The event Destroyed(); is actually never called. So you have to do your own checking to close the file, a good method is to enable the Tick() event and check if Level.NextURL != "" and then close the file. This does ofcourse not work when you shut down the server.

Important: files can only be opened once, if you try to open a file that is already opened the server will crash. So be sure to make the log file name unique per server. The following code is a usefull addition to your mod, it will allow users to configure the name of the log file with the aid of a couple place holders

function string GetServerPort()
    local string S;
    local int i;
    // Figure out the server's port.
    S = Level.GetAddressURL();
    i = InStr( S, ":" );
    return Mid(S,i+1);

function string LogFilename()
  local string result;
  result = sFileFormat;
  ReplaceText(result, "%P", GetServerPort());
  ReplaceText(result, "%N", Level.Game.GameReplicationInfo.ServerName);
  ReplaceText(result, "%Y", Right("0000"$string(Level.Year), 4));
  ReplaceText(result, "%M", Right("00"$string(Level.Month), 2));
  ReplaceText(result, "%D", Right("00"$string(Level.Day), 2));
  ReplaceText(result, "%H", Right("00"$string(Level.Hour), 2));
  ReplaceText(result, "%I", Right("00"$string(Level.Minute), 2));
  ReplaceText(result, "%W", Right("0"$string(Level.DayOfWeek), 1));
  ReplaceText(result, "%S", Right("00"$string(Level.Second), 2));
  return result;

Foxpaw: A less hacky way of having the FileLog destroy itself would be to have it destroyed, by whatever actor is using it to write stuff, in that actors destroyed function.

Category Class (UT2003)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands


Mapping Topics

Mapping Lessons

UnrealEd Interface


Scripting Topics

Scripting Lessons

Making Mods

Class Tree


Modeling Topics


Log In