Log4Net Unity Integration

Hey all,

For those wondering what Log4Net is, it’s a very capable logging library that is widely used to log information from code, it can send emails, log to servers, to exernal files, or even create your own types of loggers (called appenders), for example a unity Debug Log appender. For more information, check it out here Apache log4net – Apache log4net: Home - Apache log4net

As a side project of mine I’ve managed to integrate Log4Net into unity. I’ve even got it to run on iOS and Android at .net 2.0 Subset.

The code is open source, I only ask you share any developments you make with everyone, I’ve uploaded it up to the GitHub repository for everyone to try and contribute:

There is a dll in the latest release which should work with all versions of unity, testing pending of course, I need you guys to do that :wink:

If you have any questions feel free to ask, I too am only just grasping this library, so forgive me if I can’t answer everything. But so far I’ve seen a lot of potential for this, especially for debugging remotely.

Draxov.

cheers… awesome!

I am having trouble to use the .dll. For some reason, logs does not show up in the Console log area. Can you please provide the instruction of how to install that?

Thanks.

Hey, I’ve updated this to work with Unity 5 and included a UnityAppender and a helper for wrapping some of the features of the Unity logger with a UnityLogManager.

There is also an example config file which uses the UnityAppender on a basic level, but there is so much more you can do with it, just look at Apache log4net – Apache log4net: Home - Apache log4net

how to use it in android, which rolling file is output?

@draxov thanks for the link to repo! I’ve tried using log4net with Unity and I ran into issues with missing methods on iOS and Android when compiling with il2cpp with code stripping and no code stripping where methods were missing from log4net types.

Did you also encounter this issue and if so, how did you get around it?

Find some examples here:
ASF Git Repos - logging-log4net.git/tree - examples/ (apache.org)