Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-294

NTEventLogAppender - would be nice to point event log at DLL other than log4cxx.dll

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Won't Fix
    • 0.10.0, 0.11.0
    • None
    • Appender
    • None
    • Windows

    Description

      The problem is really one of allowing log4cxx to be statically linked to none .exe projects. If I have a myproject.dll into which I statically link log4cxx then I must have the message compiler entries in either log4cxx.dll or myexe.exe, this is not always desirable. I know that static linking is not really supported, but I suspect that this one of the only things in the way.

      So it would be helpful to have a property / option called ModulePath which would override the use of GetModuleHandleW in nteventlogappender.cpp this would make static linking of the log4cxx code much easier.

      Actually it is possible to detect the path of the module into which the code is linked, but it requires a little extra know-how, this MIGHT be a better alternative to the .exe, but would break some existing code. FYI to detect the module of the calling code call GetOurModule below:

      However, a property / option ModulePath would be great.

      HMODULE GetModuleFromAddress(const void * address)
      {
      MEMORY_BASIC_INFORMATION mbi;

      if (VirtualQuery(address, &mbi, sizeof(mbi)) != sizeof(mbi))

      { return 0; }

      return reinterpret_cast<HMODULE>(mbi.AllocationBase);
      }

      inline HMODULE GetOurModule()
      {
      return GetModuleFromAddress(reinterpret_cast<const void *>(GetOurModule));
      }

      Attachments

        Activity

          People

            carnold@apache.org Curt Arnold
            mbartosik Mark Bartosik
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: