High performance Windows C++ component of VC-Logger v2.0.3 released

Recommended for you: Get network issues from WhatsUp Gold. Not end users.

  VC-Logger is a simple to use C++ programming the logging component. The design focus on three aspects: function, availability and performance. In order to let everyone can more easily learn VC-Logger, I made a few test cases: TestGUILogger (GUI version test cases / static loading), TestDynamicLogger (GUI version test cases / dynamic loading), TestConsoleLogger (Console version test cases / static loading). ​

  (the project home page, Download: )

  Function:   the log module is designed to meet the needs of most applications log demand — — for the log output to a file or send into the application, does not provide some complex but not commonly used functions. The log module features include:

  1. The log information is output to the specified file
  2. Daily generates a log file
  3. For the GUI program, the log information is sent to the specified window
  4. For Console applications, you can put the log information is sent to standard output (std::cout)
  5. Support MBCS / UNICODE, Console / GUI program
  6. To support dynamic loading and static loading log component DLL
  7. DEBUG/TRACE/INFO/WARN/ERROR/FATAL support multiple log level

  Availability:   the log module focuses on usability, try to let the user feel convenient, comfortable:

  1. Simple and pure: do not rely on any library or framework
  2. Using the interface is simple, does not need complex configuration or setting
  3. Provide CStaticLogger and CDynamicLogger wrapper class for static or dynamic loading and operation log module, the user does not need to pay attention to the details of loading
  4. The program if you want to just create a CStaticLogger or CDynamicLogger object corresponding to each log file records a plurality of log files
  5. Just call Log () /Debug (/Trace)) (/Info) (/Warn) (/Error) (/Fatal () method to log
  6. Log recording method to support variable parameters
  7. The log output format: <> <ID> <log level threads; > <log>

  Performance:   performance index is worth using hard whether a component, the component from design to coding process as far as possible taking into account the performance optimization:

  1. Support multi threading and sends the write log requests
  2. Using a separate thread to write the log in the background, the normal execution does not affect the work of thread
  3. Using batch processing batch record log

*** Method of use ***

Method: (static loading Logger DLL)


  1. Applications include the StaticLogger.h header file
  2. Create a CStaticLogger object (usually as a global object)
  3. Call CStaticLogger-> Init (...) to initialize the logging component
  4. Use CStaticLogger-> Log (/Debug)) (/Trace) (/Info) (/Warn) (/Error) (/Fatal () method to write the log
  5. Call CStaticLogger-> UnInit (...) to clean up the logging component (CStaticLogger object destructor will automatically clean up the logging component)

Method two: (dynamic loading Logger DLL)


  1. Applications include the DynamicLogger.h header file
  2. Create a CDynamicLogger object (usually as a global object)
  3. Call CDynamicLogger-> Init (...) to initialize the logging component
  4. Use CDynamicLogger-> Log (/Debug)) (/Trace) (/Info) (/Warn) (/Error) (/Fatal () method to write the log
  5. Call CDynamicLogger-> UnInit (...) to clean up the logging component (CDynamicLogger object destructor will automatically clean up the logging component)

Method three: (direct export function to load the Logger DLL)


  1. Applications include the Logger.h header file
  2. Manual call ILoger_Create () and ILoger_Create (ILogger) to create and destroy objects of derived function 

(Note: if the dynamic loading, manual call:: LoadLibrary:: (FreeLibrary) / (API) series of function of loading and unloading of Logger DLL)


 ***** Hope to receive log information through the window of the GUI program *****

Call the SetGUIWindow A. log module initialization after the success (HWND) set the log window

The B. window shall respond to process LOG_MESSAGE messages

Call ILogger: C. finishes processing the LOG_MESSAGE message, FreeLogMsg (:) the destruction of the received TLogMsg 



  1. Windows 2000 or later (_WIN32_WINNT >= 0x0500)
  2. VC++ 2010 or later


  1. Logger_C.dll - Console/MBCS/Release
  2. Logger_CD.dll - Console/MBCS/Debug
  3. Logger_CU.dll - Console/Unicode/Release
  4. Logger_CUD.dll - Console/Unicode/Debug
  5. Logger.dll - GUI/MBCS/Release
  6. Logger_D.dll - GUI/MBCS/Debug
  7. Logger_U.dll - GUI/Unicode/Release
  8. Logger_UD.dll - GUI/Unicode/Debug


  1. TestGUILogger GUI version of the test procedure

     (Static loading)

  2. TestDynamicLogger GUI version of the test procedure

    (Dynamic loading)

  3. TestConsoleLogger Console version of the test procedure

    (Static loading)

Related posts: "Windows C++ application general log component (assembly and test program download)

  As everyone knows, in the debugging process, tracking the implementation of application, application log can provide information valuable for them. Therefore, the program operation log to the application, it is crucial to maintain.

  On how to record the program log, usually have three choices:

  1,Using Log4CXX and other public open source log component: the log component is cross platform and more powerful features, such as the log to another server or record to the database; in addition, configurability is higher, the logs are many personalization through the configuration file or program code. But from another perspective, because of these advantages are also resulted in the use of shortcomings. First of all, for general application, they do not need too many functions, usually only need to log to a file or the feedback to the application, function too much anyway, let users feel tedious also bear a lot of never have to use the code. Secondly, usually the log component is cross platform, not just the application for Windows or VC, so it feels a little uncomfortable, such as their character is of type char, for a Unicode program each time to write the log to do character conversion is a very bad thing, this seat many years ago was the use of Log4Cpp, program execution is always report log components have a memory leak, although there may be false, but it always felt very uncomfortable.

  2,Try to write a few simple class or function log yourself: this method is very simple, usually in less than one hundred or two hundred lines of code. But this method is lack of normative and universal, other programs need to record a similar but a little difference in the log, the common practice is: Copy-Paste-Modify; in addition, this kind of method is very likely did not consider the performance or concurrency problems, usually directly as a thread to write the log in, is absolutely not allowed for those applications requiring high performance.

  3,Simply do not record any log: indeed, now many applications for various reasons did not record any log. But this thought, if a program is useful, have a certain function, and the need for continuous operation for a long period of time, then the log is a must; otherwise, must carefully consider whether or not the program has the necessity of existence.


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Isaac at November 14, 2013 - 9:21 AM