Yes, I just spent two hours trying to get some output from Log4Net in Unity3D. The main problem was of course in front of the computer but I also blame the log4net online docs for not having a quick start guide that outputs to a file. I had three problems:

  • I didn’t know what the default working directory of a Unity3D app running in the editor is. (hint: It’s the root of the project folder) So I was looking all over the place for that log file to appear.
  • I copy pasted example configuration snippets from here: log4net Config Examples. I didn’t realize these are not complete config files, but just parts that need to be inserted into a real log4net config.
  • log4net does not report errors regarding to log4net in any way by default. Of course, I didn’t know this either, since who reads the complete documentation to a simple logging API right?
So the result was that log4net was unhappy with my config file but I didn’t notice it since it doesn’t report any errors. Instead, I thought that maybe Unity3D is sandboxing file system access on some level and was chasing around the usual places in the filesystem looking for my newly created log file. Not finding it I tweaked the log4net config file and went looking again. Rinse, repeat. Only after I realized that log4net was not reporting internal errors and then changing this behavior I was notified that my config file was ill formatted. From there getting it to finally work was easy.
I also made some progress with the game design.

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

 
© 2011 Jörg Rüppel | Impressum Suffusion theme by Sayontan Sinha