Jump to content
Arkensor

A3Log - A lightweight logging extension

Recommended Posts

G6n92ps.png

 

 
─────── Structure ───────

  • Motivation
  • Introduction
  • Features
  • Benchmarks
  • Installation
  • Usage
  • Final words
  • Changelog
  • Requirements
  • Download
  • Screenshots

 

 

─────── Motivation ───────
Hello there,
first I want to talk about why I made this - well there is a pretty simple reason. As a developer and as server owner you always need logs. You need logs to write debug messages, you need logs to make statistics for your squad, you need logs to be able to have a look on who did what when. Logs are awesome, and without them it would take much longer to find an error or to find out who shot who first, or how many players were on your server today. Let us have a look on the game log itself, the rpt log. It provides errors, if you have got some, and gives some debug information about startup and shutdown of the game. However since there are some errors in the game that write a nice little message every 1-2 seconds into the log-file, the rpt gets larger and larger ... and now find the one line you need.
 
Imagine, you are a server owner, and you want to keep track on who connected when on your squad server for you and some friends. Why ? Well you like it to stalk other people, or wanted to play NSA simulator 2016. You could log who connected, with which player-ID and so on ... but where do these logs go? Well I always had to log into the rpt file. Often I search for one line which is between 1000 of other lines. That does not only take time, but it might also happen, that you do not find the line, even if you go through everything 10 times. That is where I had the idea, well ... why not create an extension where you decide where logs are placed, in which format, how they are named, if they should have got a time stamp, if this time stamp should be in 12 or 24 hour format etc.
 
I wanted a simple extension where you setup a config, and then just call a function with content, and maybe optional a name which is used for separation. Simple but fast, with options, so that you can get logs from ArmA just the way you want it. I already made a extension called Arma3Log a while ago but I was new into extension writing, and you could have seen that ... it was slow and not very useful... but I wanted to do better and here we are.
 

─────── Introduction ───────
A3log is a lightweight logging extension for ArmA III, which allows it's users to write customized log-files with a very high performance.
It is very easy to use, and does not require and advanced skills for the setup, or the usage. The log-files are adjustable in nearly every way, you could come up with in case of writing log-files.
Even when dealing with a high amount of data, the server will not be slowed down and there is no data loss.
As it is still in development, there will be improvements to the speed and the amount of features / settings.


─────── Features ───────

  • Timestamp inside the logfile
  • Timestamp (Date) within the filename
  • Extend the filename with the minute of creation
  • Changeable timestamp format 12/24H clock
  • Custom directory to place the logs (Full-/Relative path)
  • Choose the name of the file
  • Choose the file-extension
  • Define a unlimited amount of custom log categories
  • Separate each log category as one folder
  • Define path and name of the configuration ini

 

─────── Benchmarks ───────
1000 lines with 100 characters each:

  • 0.052 seconds - diag_log
  • 0.0159998 seconds - A3log (with all features enabled at v1.1)

Extreme example: 100.000 lines with 100 charaters each:

  • 55,895 seconds - diag_log
  • 15,2 seconds - A3log (with all features enabled at v1.1)

Note: The test conditions for the benchmarks were reset for every run. The value in seconds is the middle value of 10 test runs. The time indicates how long it took for ArmA to process the input and output of the extension, so how long the server was under heavy load to send the content to the extension.


─────── Installation ───────

  • Download the latest version (See download section for that)
  • Extract the @A3Log folder and place it in your server directory
  • Go into the @A3Log folder and make sure the the A3Log.dll is not blocked
  • Edit the A3Log.ini file to fit your personal need -> Save the file
  • Edit your startup file and add @A3Log to your -serverMod / -mod parameter

  • Optional: To specify from where the config should be loaded you can define startup a paramter for the arma3server executable with
    "-A3Log=Configurations/Mylogs.ini" 
    (Only paths in your arma3server directory are allowed so in this case you would have a folder called Configurations inside of your serversetup and in that you have the config file called Mylogs.ini) - This feature is WIP
  • Remove the A3Log_examples.pbo inside @A3Log/addons, once it worked for you and you got example log files
  • Done

 

─────── Usage ───────
The A3Log.pbo provides you with the A3Log function, which you can call from anywhere. In addiotion to that there is a serverside PublicVariableEventHandler (sendlogfile) to catch incoming log entries, which may be send via publicVariableServer
 
So an example for serverside use would be:

["I am Superman!"] call A3Log;

This one has no category defined, so it goes into the catch all log (See A3Log.ini for this)
---

["I am Batman!","ExampleLog"] call A3Log;

This one goes into the ExampleLog.log, or what ever you called it.
 
 
An example for sending a log from a client / headless client would be:

sendlogfile = ["I am Batman!","ExampleLog"];
publicVariableServer "sendlogfile";

You might need to whitelist this in the publicvariable.txt from Battleye with !="sendlogfile"
---

Or if you prefer remoteExec

["I am Batman!","ExampleLog"] remoteExecCall ["A3Log", 2]; //2 = send to server only and call is much faster

Note: You would need to whitelist A3Log as a function that can only be executed on the server.
---
 
So to describe the usage in general:
The function A3Log (Serverside) handles the input and sends it to the A3Log extension.

<Paramter> call A3Log; 

---

<Paramter> is an array [], which you can send up to 2 paramters in.

[<text>,<category (This second one is optional)>] call A3Log;

Attention! - If you want to rewrite the function that sends the log message to the extension, you need to include the information separator byte, which can be used in ArmA like this:

<bla bla text> + toString[31] + <your-cool-category> //This all is from variable type string 

---
 
You can use this extension as client mod too, just make sure to disable Battleye, as the dll would get blocked by BE otherwise.
 

─────── Final words ───────
I will provide some additional usage examples and code snippets inside the A3Log_examples.pbo in the future.
This is not a drag and drop everything will be logged for every mission you use addon. You still need to invest some time into the configuration and your setup, what you want to log.
Since there are many versions of missions, which all differ in their code like an eventhandler for being killed or something, I can not provide code that fits with just a simple copy and paste.
 
How ever I offer everybody to send me a request on these forums or via arkensor@gmail.com so that I can help him with either the setup or write some lines of code from him.
 
I will expand this extension with my own ideas, and requests you guys might have, and it would be great to have some feedback on this.
 
 
At this point I would like to thank Killzone_Kid, for making a great documentation and tutorials about extensions, which made me start with extension making for arma3. 
And thanks to my teammate Maurice for helping me with some magic c++ code!
 
If you want to support me and my work, you can send me a donation via paypal.
Thank you very much!
 
btn_donate_LG.gif
 
 
─────── Changelog ───────

v1.7:

- [Added] x64 support for Windows and Linux .
 

v1.6:

- [Added] Optional console output for Windows.
- Formating and preparations for a colored debug output

 

Older versions:

 

v1.5:

- [Added] Combine custom logs by date into one folder
- Small formating changes and bugfixes

 

v1.4
- [Added] Support to have the current date included in the log file messages. ( YYYY-MM-DD )
- Changed version number to 1.4 for the version command
 

v1.3:
- [Added] Linux support
- [Added] Linux source code & compiler guide
- [Added] Version check following the guidlines in the wiki: https://community.bistudio.com/wiki/Extensions
 
v1.2:
- [Added] Option to only use custom logs, so that the extension does not produce a unused main log file, if you do not use it at all - Idea from some users, not mine!
- [Fixed] The addon config.cpp did not contain required arrays, thx to tankbuster for that report (Both addon pbo's had that issue) 
 
v1.1
- Included the sourcecode for windows DLL
- [Added] Option to place the config.ini where ever you like and name it what ever you like. (See installation)
- [improved] Changed the code so that people who want to compile it, can use the compiler from VS2013 and VS2015
 
v1.0:
- Initial public release

v0.9:
- [Added] Support for 12H clock

v0.8:
-[Added] Support for full and relative paths

 
─────── Requirements ───────
Windows: C++ Redistributable 2013 32-Bit - Download -> vcredist_x86 (This should be pre installed on all hosting providers)
 

─────── Download ───────
Download the file at armaholic.com:
news_download_a3_3.png

 

─────── Screenshots ───────
 
This is my folder where I place my logs at serverdir/@A3Log/Logs:
sKXfZqm.png
Note: Inside the folders are files which were written as the config had folder seperation enabled. 
 
License:
qn8A7ON.png

If you have got any questions feel free to ask.
Help me with your feedback to improve this project!
 
Now have fun with it, and enjoy your clean log files :)
 
 

Regards Arkensor

  • Like 6

Share this post


Link to post
Share on other sites

Works great thanks !

Now it will be easier to find out why i have some fps drops at specific moments :-D

[21:28:30] FPS : 44.3213 ||| entities : 23 ||| vehicles : 4 || players : 15

[21:31:30] FPS : 41.6667 ||| entities : 31 ||| vehicles : 8 || players : 21

[21:34:30] FPS : 45.0704 ||| entities : 51 ||| vehicles : 14 || players : 42

[21:37:30] FPS : 44.8179 ||| entities : 69 ||| vehicles : 20 || players : 52

[21:40:31] FPS : 38.5542 ||| entities : 84 ||| vehicles : 29 || players : 66

[21:43:31] FPS : 46.5116 ||| entities : 97 ||| vehicles : 39 || players : 76

[21:46:31] FPS : 47.0588 ||| entities : 111 ||| vehicles : 42 || players : 81

[21:49:31] FPS : 46.9208 ||| entities : 236 ||| vehicles : 54 || players : 85

[21:52:32] FPS : 35.6347 ||| entities : 248 ||| vehicles : 56 || players : 88

[21:55:32] FPS : 31.3725 ||| entities : 234 ||| vehicles : 59 || players : 93

[21:58:33] FPS : 23.9521 ||| entities : 250 ||| vehicles : 62 || players : 98

[22:01:34] FPS : 26.2726 ||| entities : 264 ||| vehicles : 82 || players : 101

[22:04:34] FPS : 21.3049 ||| entities : 149 ||| vehicles : 90 || players : 102

[22:07:37] FPS : 13.6635 ||| entities : 153 ||| vehicles : 100 || players : 108

[22:10:42] FPS : 12.8721 ||| entities : 292 ||| vehicles : 104 || players : 111

[22:13:46] FPS : 16.0321 ||| entities : 187 ||| vehicles : 110 || players : 114

[22:17:05] FPS : 9.4173 ||| entities : 342 ||| vehicles : 124 || players : 116

[22:20:41] FPS : 12.4902 ||| entities : 208 ||| vehicles : 134 || players : 116

[22:24:00] FPS : 12.9241 ||| entities : 242 ||| vehicles : 149 || players : 119

[22:27:10] FPS : 13.7812 ||| entities : 249 ||| vehicles : 154 || players : 119

[22:30:38] FPS : 10.589 ||| entities : 239 ||| vehicles : 160 || players : 120

  • Like 1

Share this post


Link to post
Share on other sites
Just a quick update on what is planned for the next two versions:
 
Upcoming release (v1.1) - Released:
  • Including the sourcecode for windows dll
  • [Added] Option to place the config.ini where ever you like and name it what ever you like. It will be read from the startup paramters. ("-A3Log=C:\Full\Or\Realtive\Path\Mycnf.ini")
  • [improved] Changed the code so that people who want to do it, can use the compiler from VS2013 and VS2015
 
Upcoming release (v1.X) :
  • [Added] Support for linux 
  • [Added] Sourcecode for linux version

 

I will also take care about Battleye and try to get a whitelist for this as client mod.

 

Again if someone wants a feature for this extension or wants to make a request for anyother extension he might need message me or reply to this topic.

 

 

Regards Arkensor

Share this post


Link to post
Share on other sites

Version 1.1 has been released

 

See changelog for details

 

Sourcecode is now included!

 

Get the latest version here:

 

news_download_a3_3.png

 

 

Regards Arkensor

Share this post


Link to post
Share on other sites

I'm getting this just after the role selection screen.

2016/04/06, 22:50:56 Warning Message: No entry 'bin\config.bin/CfgPatches/A3Log.units'.

Share this post


Link to post
Share on other sites

I'm getting this just after the role selection screen.

2016/04/06, 22:50:56 Warning Message: No entry 'bin\config.bin/CfgPatches/A3Log.units'.

Allright I will fix that. You need to go into the config.cpp and ad an config Array for units at the top.

I will include that in an quick update later, but until then that should fis it for you ;)

Regards Arkensor

  • Like 1

Share this post


Link to post
Share on other sites
Version 1.2 released:

 

- [Added] Option to only use custom logs, so that the extension does not produce a unused main log file, if you do not use it at all - Idea from some users, not mine!

- [Fixed] The addon config.cpp did not contain required arrays, thx to tankbuster for that report (Both addon pbo's had that issue) 

  • Like 1

Share this post


Link to post
Share on other sites

You have my respect.

I had a version long still old to yours on my server and was contented to 100%.

But now you have laid out one over again. 

Good work, further in such a way :) 
 
Yours sincerely 
RAinZz5718
  • Like 1

Share this post


Link to post
Share on other sites

I am using Dev branch which uses the mods from the normal arma3 folder.

 

The A3Log-Error.log is generated in the dev branch folder.

[A3Log] :: [Error] Could not find A3Log.ini file! Make sure the file exists and that it is placed withing the arma3server root directory, or the place where the dll is placed too!

I have placed the ini file in the dev branch folder and its works.

One other issue , I am exporting configs using your log categories and use _br = toString [13,10];

This is producing double line feeds in the output, the normal diaglog and copy to clipboard do not do this.

Well done nice tool/addon.

Share this post


Link to post
Share on other sites

I am using Dev branch which uses the mods from the normal arma3 folder.

 

The A3Log-Error.log is generated in the dev branch folder.

[A3Log] :: [Error] Could not find A3Log.ini file! Make sure the file exists and that it is placed withing the arma3server root directory, or the place where the dll is placed too!

I have placed the ini file in the dev branch folder and its works.

 

This is because it searches for it on the windows file system. The place where the extension gets executed, is the place where the addon must go. Did you try to give a path using the config paramter -A3Log= option ? Maybe you could use that to direct him to the main branch folder? If you could try that out, and give me some feedback that would be very useful.

 

I maybe will try that one out later, but I need to switch to the devbranch which takes some hours for my ***** slow internet.

 

One other issue , I am exporting configs using your log categories and use _br = toString [13,10];

This is producing double line feeds in the output, the normal diaglog and copy to clipboard do not do this.

 

The problem is that the extension already writes a end-line-break after earch writing process, so if you include one endline from arma, the extension adds another one and there you go, you habe got 2. 

You can avoid this, if you do not use a end-line in the arma code. 

I could make an option so that you decide where to break to a new line from arma, and that the extension does not care about that at all, but that would be nearly all other options² for making cases for that, and that just slows things down and makes it complicated.

 

However if you need, I can easisly make a version just for you, who does not make any line breaks at all, so you take care about them in arma ;) If you want it feel free to contact me.

 

Thank you very much for the feedback.

 

 

Regards Arkensor

Share this post


Link to post
Share on other sites

Could this be used to get a series of FPS measurements during a mission into a file for analysis? That way one could trace which parts of the mission are taxing. I am thinking about an fps measure for every second or every 5 s.

 

-OP

Share this post


Link to post
Share on other sites

Could this be used to get a series of FPS measurements during a mission into a file for analysis? That way one could trace which parts of the mission are taxing. I am thinking about an fps measure for every second or every 5 s.

 

-OP

 

Yes that should work. Note that even if you fire up 1000 messaged which had 100 characters, so quite a long message, they will be written within no time. So making a debug log for you fps, the extension will not be a bottleneck.

 

You could get the client fps and maybe his position and log that every 1-2 seconds, and that should give you a lot of information about where the fps go down etc, and then you teleport the the psotion written in the log and have a look why it dropped there.

 

BTW: 

I messaged BE yesterday to whitelist the pro compiled version, hopefully they react on that, so people can use this with BE enabled. You do not get banned of this, since I do not interact with the memory, but currently on execution the extension gets bloked.

Since I released the soruce code, there should not be a any reason BE would block this anymore, so lets see and wait for them ;)

 

 

Regards Arkensor

Share this post


Link to post
Share on other sites

Hello,

 

Thank you very much for your work, that's everything I needed for my project.

The thing is, I work with linux, and I saw the Linux extension should be released soon.

 

Do you have an idea about when ?

 

Very great job, :)

Max

Share this post


Link to post
Share on other sites

Hello,

 

Thank you very much for your work, that's everything I needed for my project.

The thing is, I work with linux, and I saw the Linux extension should be released soon.

 

Do you have an idea about when ?

 

Very great job, :)

Max

 

Dear SmokeMax,

thank you for you kind words. Yes I am currently working on it, but I have been quite busy the last weeks. I will continue working on it this week, and hope to release it on the weekend. If you wish, you can PM me, so that you can get a preview build as soon as I have one ready, so that you could test things out and give me some feedback.

 

 

Regards Arkensor

Share this post


Link to post
Share on other sites

Hello guys,

 

just a quick update on the linux version. I just compiled the third running version of A3Log, which now features all the conent from the windows version.

Before I release it in public, I need some testers for it, since I changed some things, and do not have got much experince oabout linux servers, and their potential issues.

 

If someone is willing to give it a try and give me some feedback please drop me a pm on these forums, and I'll send him a download link asap.

 

If the testing goes well, I look forward to release it on friday, and be sure to check out the armaholic page then, since updates go there first - http://www.armaholic.com/page.php?id=30684 ;) 

 

 

Also thank you for you support, I recived alot of postive feedback and some suggestions. I really appreciate that and I am glad that this little project was helpful to some people.

 

 

Regards Arkensor

Share this post


Link to post
Share on other sites

Upcoming release 1.4:

- [Added] Option to have the date included in the log message (Requsted by users who use a all in one file without log rotation)

 

Expected timeframe for the relase is next weekend

 

 

Regards Arkensor

Share this post


Link to post
Share on other sites

Upcoming release 1.5 with additional folder seperation options.

Thank you @Nark0t1k for this suggestion :)

 

Regards Arkensor

Share this post


Link to post
Share on other sites

Release 1.5 will now be tested for a few days from beta testers and will be released next week.

 

Regards Arkensor

Share this post


Link to post
Share on other sites

Hi one question,

 

does this logger work in server config.cfg event handlers(onUnsignedData, onHackedData,...)?

 

I want to log failed connects to server. I want to know why it happens.

 

Cheers, IA.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×