Datalogging C++

Hello there
I saw this video by RealPars which introduces you to using C++ in PLCnext Engineer: https://youtu.be/Sf7fzsUb1yI?si=8TKjKH5GNkSfT2W5&t=345
They use a log function to log how many times a motor is started. The log is saved in „Output.log“. The problem with this is that every other log action from the plc is also saved here.
image.png
I’ve got following questions:
Is there a way to change the directory for the log function? This way only the motor log is present in the log file.
Can a log be saved in another format, .db or .csv for example?
Lastly I was wondering if there is any documentation for the C++ functions for PLCnext.
Thanks in advance
Mathieu

Hi Mathieu,
Have you checked out this website? PLCnext Runtime
Additionally, refer to the appendix on this site for more links to other websites that provide useful information.

Hello MathieuCalloens,
you can use for logging the datalogger Service: DataLogger concept (plcnext.help)Is it possible to log following Datatypes: RSC GDS services (plcnext.help)image.pngPlease find the Logging Class documentation under following link:
PLCnext API Documentation: Arp::System::Commons::Diagnostics::Logging::Log Class Reference
I would not recommend changing the path of the log files (“Output.log”). This is the standard path and is used for diagnostics. You can also create your own log file/path in C++ and use it to provide the messages separately. Or use the IDataLogger Service to log the Messages in SQLite datasink (you can also convert/export the entrys in .csv-format).
Or you can use the „Simple-Logger“ Library and log the massages in PLCnEng-Application: PLCnext Store | SimpleLogger. In this case it is also possible to provide the IEC_String from C+±Application to IEC-Application via Port-Variables: CppExamples/Examples/CppDataTypeTest/README.md at master · PLCnext/CppExamples · GitHub
I hope it helps.
BR Eduard

Thanks Eduard! You’ve provided me with a lot of useful information.