Re: [PR] Fix empty string received by .NET 8 users on Linux on userName (logging-log4net)

2024-10-24 Thread via GitHub


gdziadkiewicz commented on code in PR #199:
URL: https://github.com/apache/logging-log4net/pull/199#discussion_r1815747496


##
src/log4net/Core/LoggingEvent.cs:
##
@@ -742,15 +742,27 @@ private static string ReviseThreadName(string? threadName)
   {
 if (_platformDoesNotSupportWindowsIdentity)
 {
-  // we've already received one PlatformNotSupportedException
+  // we've already received one PlatformNotSupportedException or null from 
TryReadWindowsIdentityUserName
   // and it's highly unlikely that will change
   return Environment.UserName;
 }
 
 try
 {
-  return _cachedWindowsIdentityUserName ??=
-  TryReadWindowsIdentityUserName();
+  if(_cachedWindowsIdentityUserName is not null)
+  {
+return _cachedWindowsIdentityUserName;
+  }
+  else if(TryReadWindowsIdentityUserName() is string userName)
+  {
+_cachedWindowsIdentityUserName = userName;
+return _cachedWindowsIdentityUserName;
+  }
+  else
+  {
+_platformDoesNotSupportWindowsIdentity = true;
+return Environment.UserName;
+  }

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] Allow for a FMT layout configuration when log4cxx is statically linked [logging-log4cxx]

2024-10-24 Thread via GitHub


swebb2066 opened a new pull request, #422:
URL: https://github.com/apache/logging-log4cxx/pull/422

   This PR prevents the fault:
   `log4cxx: Could not instantiate class [org.apache.log4j.FMTLayout].`
   when loading a configuration that uses FMTLayout and the application was 
linked to a Log4cxx static library.
   
   The code for FMTLayout is not bound into the application when the code does 
not include a reference to FMTLayout.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump net.bytebuddy:byte-buddy from 1.15.5 to 1.15.7 (logging-log4j2)

2024-10-24 Thread via GitHub


github-actions[bot] merged PR #3116:
URL: https://github.com/apache/logging-log4j2/pull/3116


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Fix empty string received by .NET 8 users on Linux on userName (logging-log4net)

2024-10-24 Thread via GitHub


gdziadkiewicz commented on code in PR #199:
URL: https://github.com/apache/logging-log4net/pull/199#discussion_r1815767811


##
src/log4net/Core/LoggingEvent.cs:
##
@@ -774,12 +783,17 @@ private static string ReviseThreadName(string? threadName)
   }
 
   private string? _cachedWindowsIdentityUserName;
-  private static string TryReadWindowsIdentityUserName()
+  
+  /// 
+  /// TODO

Review Comment:
   Add



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] SIGSEV in log4cxx::helpers::Class::toString() [logging-log4cxx]

2024-10-24 Thread via GitHub


dingetje commented on issue #420:
URL: 
https://github.com/apache/logging-log4cxx/issues/420#issuecomment-2435655654

   With the shared log4cxx library, all tests are pass.
   
   The SIGSEV still happens though, so I'm at a loss
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] SIGSEV in log4cxx::helpers::Class::toString() [logging-log4cxx]

2024-10-24 Thread via GitHub


rm5248 commented on issue #420:
URL: 
https://github.com/apache/logging-log4cxx/issues/420#issuecomment-2436213853

   Line 101 is [the definition of the 
function](https://github.com/apache/logging-log4cxx/blob/0ff3c8a454bd2de1bd911293af8febe42ab25b70/src/main/cpp/class.cpp#L101),
 which is odd.  My best guess is that the reason it says that line is 
segfaulting is due to a mismatch between the C++ library that log4cxx was 
compiled with and the library it is running with.
   
   libstdc++ is generally stable between versions with backwards compatibility, 
but probably some part of the definition of `std::string` changed between the 
versions.
   
   Some things to try:
   
   1. Force C++11 with `-DCMAKE_CXX_STANDARD=11`
   2. Use an older compiler(e.g. the one that libstdc++ was compiled with)
   3. Check to see when g++ is running which version of libstdc++ it is using, 
if it is the one bundled with the compiler or the one on the system


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[I] SIGSEV in log4cxx::helpers::Class::toString() [logging-log4cxx]

2024-10-24 Thread via GitHub


dingetje opened a new issue, #420:
URL: https://github.com/apache/logging-log4cxx/issues/420

   I have build log4cxx 1.3.0 from source using CMake on RHEL7 with devtools-11
   
   All tests are pass, 
   
   But when I link this log4cpp into my own shared library the application 
crashes immediately when I try to load my shared library in a test application:
   
   
   Program received signal SIGSEGV, Segmentation fault.
   0x769d5638 in log4cxx::helpers::Class::toString() const () from 
/home/antoinem/projects/log4cxx/apache-log4cxx-1.3.0/build/log4cxx/src/main/cpp/liblog4cxx.so.15
   (gdb) info stack
   #0  0x769d5638 in log4cxx::helpers::Class::toString() const () from 
/home/antoinem/projects/log4cxx/apache-log4cxx-1.3.0/build/log4cxx/src/main/cpp/liblog4cxx.so.15
   #1  0x7fffee5cb863 in log4cxx::helpers::Class::registerClass 
(newClass=newClass@entry=0x7fffee8634f0 
) at 
class.cpp:101
   #2  0x7fffee5cbad9 in log4cxx::helpers::Class::Class 
(this=0x7fffee8634f0 
, 
name=...) at class.cpp:47
   #3  0x7fffee5c1e56 in ClassAppenderAttachableImpl (this=0x7fffee8634f0 
) at 
../include/log4cxx/helpers/appenderattachableimpl.h:46
   #4  __static_initialization_and_destruction_0 (__initialize_p=1, 
__priority=65535) at appenderattachableimpl.cpp:27
   #5  _GLOBAL__sub_I_appenderattachableimpl.cpp(void) () at 
appenderattachableimpl.cpp:143
   #6  0x77dea9c3 in _dl_init_internal () from 
/lib64/ld-linux-x86-64.so.2
   #7  0x77def59e in dl_open_worker () from /lib64/ld-linux-x86-64.so.2
   #8  0x77dea7d4 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
   #9  0x77deeb8b in _dl_open () from /lib64/ld-linux-x86-64.so.2
   #10 0x77bd7fab in dlopen_doit () from /lib64/libdl.so.2
   #11 0x77dea7d4 in _dl_catch_error () from /lib64/ld-linux-x86-64.so.2
   #12 0x77bd85ad in _dlerror_run () from /lib64/libdl.so.2
   #13 0x77bd8041 in dlopen@@GLIBC_2.2.5 () from /lib64/libdl.so.2
   #14 0x00400719 in main () at main.cpp:9
   (gdb)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Create `DefaultLayout` independent of `PatternLayout` (logging-log4j2)

2024-10-24 Thread via GitHub


ppkarwasz commented on code in PR #3118:
URL: https://github.com/apache/logging-log4j2/pull/3118#discussion_r1814743047


##
log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java:
##
@@ -49,4 +61,60 @@ public DefaultConfiguration() {
 
 @Override
 protected void doConfigure() {}
+
+static Layout createDefaultLayout() {
+return new DefaultLayout();
+}
+
+/**
+ * A simple layout used only by {@link DefaultConfiguration}
+ * 
+ *   This layout allows to create applications that don't contain {@link 
org.apache.logging.log4j.core.layout.PatternLayout}
+ *   and all its patterns, e.g. GraalVM applications.
+ * 
+ */
+private static final class DefaultLayout extends AbstractLayout {
+
+private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];

Review Comment:
   We can do better and use `null`.
   
   Fixed in 
https://github.com/apache/logging-log4j2/pull/3118/commits/bf892e169e273d3e9c4e4812e4ffac4178460a3d



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump actions/checkout from 4.2.1 to 4.2.2 [logging-parent]

2024-10-24 Thread via GitHub


github-actions[bot] merged PR #278:
URL: https://github.com/apache/logging-parent/pull/278


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] CompositeFilter doesn't work with multiple MarkerFilters (logging-log4j2)

2024-10-24 Thread via GitHub


mgaceanu closed issue #3104: CompositeFilter doesn't work with multiple 
MarkerFilters
URL: https://github.com/apache/logging-log4j2/issues/3104


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Create `DefaultLayout` independent of `PatternLayout` (logging-log4j2)

2024-10-24 Thread via GitHub


ppkarwasz commented on code in PR #3118:
URL: https://github.com/apache/logging-log4j2/pull/3118#discussion_r1814744252


##
log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java:
##
@@ -49,4 +61,60 @@ public DefaultConfiguration() {
 
 @Override
 protected void doConfigure() {}
+
+static Layout createDefaultLayout() {

Review Comment:
   Fixed in 
https://github.com/apache/logging-log4j2/pull/3118/commits/bf892e169e273d3e9c4e4812e4ffac4178460a3d



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] SIGSEV in log4cxx::helpers::Class::toString() [logging-log4cxx]

2024-10-24 Thread via GitHub


dingetje commented on issue #420:
URL: 
https://github.com/apache/logging-log4cxx/issues/420#issuecomment-2435596860

   I've build using static APR and APU libraries because there are already 
older versions installed:
   
   
   ~/projects/cmake/cmake-3.13.5-Linux-x86_64/bin/cmake -B build/log4cxx 
-DAPR_STATIC=yes -DAPU_STATIC=yes -DCMAKE_PREFIX_PATH=$HOME/libraries 
-DCMAKE_INSTALL_PREFIX=$HOME/Libraries -DBUILD_SHARED_LIBS=off 
-DCMAKE_BUILD_TYPE=Release 
-DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-11/root/usr/bin/g++ 
-DCMAKE_C_COMPILER=/opt/rh/devtoolset-11/root/usr/bin/gcc
   -- The CXX compiler identification is GNU 11.2.1
   -- Check for working CXX compiler: /opt/rh/devtoolset-11/root/usr/bin/g++
   -- Check for working CXX compiler: /opt/rh/devtoolset-11/root/usr/bin/g++ -- 
works
   -- Detecting CXX compiler ABI info
   -- Detecting CXX compiler ABI info - done
   -- Detecting CXX compile features
   -- Detecting CXX compile features - done
   -- Found APR: /home/antoinem/libraries/lib/libapr-1.a  
   -- Found APR-Util: /home/antoinem/libraries/lib/libaprutil-1.a  
   -- Looking for C++ include pthread.h
   -- Looking for C++ include pthread.h - found
   -- Looking for pthread_create
   -- Looking for pthread_create - not found
   -- Looking for pthread_create in pthreads
   -- Looking for pthread_create in pthreads - not found
   -- Looking for pthread_create in pthread
   -- Looking for pthread_create in pthread - found
   -- Found Threads: TRUE  
   -- Found EXPAT: /usr/lib64/libexpat.so (found version "2.1.0") 
   -- Looking for C++ include locale
   -- Looking for C++ include locale - found
   -- Looking for mbsrtowcs
   -- Looking for mbsrtowcs - found
   -- Looking for wcstombs
   -- Looking for wcstombs - found
   -- Looking for fwide
   -- Looking for fwide - found
   -- Looking for syslog
   -- Looking for syslog - found
   -- Looking for pthread_sigmask
   -- Looking for pthread_sigmask - found
   -- Looking for pthread_self
   -- Looking for pthread_self - found
   -- 
   -- 
   -- log4cxx configuration summary:
   -- 
   --   C++ compiler  : 
/opt/rh/devtoolset-11/root/usr/bin/g++
   --   C++ features requested: . : 20
   --   Build shared library  : off
   --   Build tests . : ON
   --   Build examples... : ON
   --   Build fuzzers : OFF
   --   Build site .. : OFF
   --   Install prefix .. : /home/antoinem/Libraries
   --   log4cxx library name  : log4cxx
   --   log4cxx namespace ... : log4cxx
   --   log4cxx char API  : ON
   --   log4cxx wchar API ... : ON
   --   log4cxx unichar API . : OFF
   --   log4cxx char type ... : utf-8
   --   character encoding .. : utf-8
   --   Networking support .. : ON
   --   DOMConfigurator support . : ON
   --   Qt support .. : OFF
   -- C++ version and Boost settings:
   --   Prefer boost: ... : OFF
   --   make_unique implementation :. : std::make_unique
   --   filesystem implementation ... : std::filesystem
   --   format implementation ... : fmt::format
   --   thread_local support? ... : TRUE
   -- Applications required for tests:
   --   zip . : /bin/zip
   --   sed . : /bin/sed
   --   gzip  : /bin/gzip
   -- Available appenders:
   --   Async Appender .. : ON
   --   ODBC Appender ... : OFF
   --   DB Appender . : ON
   --   SMTP Appender ... : OFF
   --   XMLSocketAppender ... : ON
   --   SocketHubAppender ... : ON
   --   SyslogAppender .. : ON
   --   Using syslog.h .. : ON
   --   TelnetAppender .. : ON
   --   NTEventLogAppender .. : OFF
   --   OutputDebugStringAppender ... : ON
   --   ConsoleAppender . : ON
   --   FileAppender  : ON
   --   RollingFileAppender . : ON
   --   MultiprocessRollingFileAppender . : OFF
   -- Available layouts:
   --   HTMLLayout .. : ON
   --   JSONLayout .. : ON
   --   PatternLayout ... : ON
   --   SimpleLayout  : ON
   --   XMLLayout ... : ON
   --   FMTLayout ... : OFF
   -- Configuring done
   -- Generating done
   CMake Warning:
 Manually-specified variables were not used by the project:
   
   CMAKE_C_COMPILER
   
   
   -- Build files have been written to: 
/home/antoinem/projects/log4cxx/apache-log4cxx-1.3.0/build/log4cxx
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specifi

Re: [PR] Fix empty string received by .NET 8 users on Linux on userName (logging-log4net)

2024-10-24 Thread via GitHub


gdziadkiewicz commented on PR #199:
URL: https://github.com/apache/logging-log4net/pull/199#issuecomment-2436449916

   @FreeAndNil I'm wondering about two parts of the code. One is the:
   ```csharp
   catch
   {
 return null;
   }
   ```
   Should it really be the only place that doesn't fail back to 
`Environment.User`
   
   and the second is the first if utilizing the flag:
   ```csharp
   if (_platformDoesNotSupportWindowsIdentity)
   {
 // we've already received one PlatformNotSupportedException or null 
from TryReadWindowsIdentityUserName
 // and it's highly unlikely that will change
 return Environment.UserName;
   }
   ```
It is the only piece of code outside of the try block. It would be highly 
unfortunate to get an unhandled exception from it(based on impl details 
`Environment.UserName` can throw ). WDYT?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [I] SIGSEV in log4cxx::helpers::Class::toString() [logging-log4cxx]

2024-10-24 Thread via GitHub


swebb2066 commented on issue #420:
URL: 
https://github.com/apache/logging-log4cxx/issues/420#issuecomment-2436770492

   > #0  0x769d5638 in log4cxx::helpers::Class::toString() const () 
from 
/home/antoinem/projects/log4cxx/apache-log4cxx-1.3.0/build/log4cxx/src/main/cpp/liblog4cxx.so.15
   
   The function `Class::toString()` is not called from `Class::registerClass` 
in the current code base. A Jan 2005 (commit 
c697bcda40461c33b0ff2411307823be05a63204) replaced that call with a call to 
`Class::getName`.
   
   Somehow you seem to be using an old version of the code.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[PR] Simplify the Class interface in the next ABI [logging-log4cxx]

2024-10-24 Thread via GitHub


swebb2066 opened a new pull request, #421:
URL: https://github.com/apache/logging-log4cxx/pull/421

   This Pr remove the internal (unused) Class::toString() method in the next 
ABI version 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Fix empty string received by .NET 8 users on Linux on userName (logging-log4net)

2024-10-24 Thread via GitHub


gdziadkiewicz commented on code in PR #199:
URL: https://github.com/apache/logging-log4net/pull/199#discussion_r1815747143


##
src/log4net/Core/LoggingEvent.cs:
##
@@ -742,15 +742,27 @@ private static string ReviseThreadName(string? threadName)
   {
 if (_platformDoesNotSupportWindowsIdentity)
 {
-  // we've already received one PlatformNotSupportedException
+  // we've already received one PlatformNotSupportedException or null from 
TryReadWindowsIdentityUserName
   // and it's highly unlikely that will change
   return Environment.UserName;
 }
 
 try
 {
-  return _cachedWindowsIdentityUserName ??=
-  TryReadWindowsIdentityUserName();
+  if(_cachedWindowsIdentityUserName is not null)
+  {
+return _cachedWindowsIdentityUserName;
+  }
+  else if(TryReadWindowsIdentityUserName() is string userName)
+  {
+_cachedWindowsIdentityUserName = userName;
+return _cachedWindowsIdentityUserName;
+  }
+  else
+  {

Review Comment:
   Done



##
src/log4net/Core/LoggingEvent.cs:
##
@@ -742,15 +742,27 @@ private static string ReviseThreadName(string? threadName)
   {
 if (_platformDoesNotSupportWindowsIdentity)
 {
-  // we've already received one PlatformNotSupportedException
+  // we've already received one PlatformNotSupportedException or null from 
TryReadWindowsIdentityUserName
   // and it's highly unlikely that will change
   return Environment.UserName;
 }
 
 try
 {
-  return _cachedWindowsIdentityUserName ??=
-  TryReadWindowsIdentityUserName();
+  if(_cachedWindowsIdentityUserName is not null)
+  {
+return _cachedWindowsIdentityUserName;
+  }
+  else if(TryReadWindowsIdentityUserName() is string userName)
+  {
+_cachedWindowsIdentityUserName = userName;
+return _cachedWindowsIdentityUserName;
+  }
+  else
+  {
+_platformDoesNotSupportWindowsIdentity = true;

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Fix empty string received by .NET 8 users on Linux on userName (logging-log4net)

2024-10-24 Thread via GitHub


gdziadkiewicz commented on code in PR #199:
URL: https://github.com/apache/logging-log4net/pull/199#discussion_r1815746788


##
src/log4net/Core/LoggingEvent.cs:
##
@@ -742,15 +742,27 @@ private static string ReviseThreadName(string? threadName)
   {
 if (_platformDoesNotSupportWindowsIdentity)
 {
-  // we've already received one PlatformNotSupportedException
+  // we've already received one PlatformNotSupportedException or null from 
TryReadWindowsIdentityUserName
   // and it's highly unlikely that will change
   return Environment.UserName;
 }
 
 try
 {
-  return _cachedWindowsIdentityUserName ??=
-  TryReadWindowsIdentityUserName();
+  if(_cachedWindowsIdentityUserName is not null)

Review Comment:
   Done



##
src/log4net/Core/LoggingEvent.cs:
##
@@ -742,15 +742,27 @@ private static string ReviseThreadName(string? threadName)
   {
 if (_platformDoesNotSupportWindowsIdentity)
 {
-  // we've already received one PlatformNotSupportedException
+  // we've already received one PlatformNotSupportedException or null from 
TryReadWindowsIdentityUserName
   // and it's highly unlikely that will change
   return Environment.UserName;
 }
 
 try
 {
-  return _cachedWindowsIdentityUserName ??=
-  TryReadWindowsIdentityUserName();
+  if(_cachedWindowsIdentityUserName is not null)
+  {
+return _cachedWindowsIdentityUserName;
+  }
+  else if(TryReadWindowsIdentityUserName() is string userName)
+  {
+_cachedWindowsIdentityUserName = userName;
+return _cachedWindowsIdentityUserName;
+  }
+  else

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Fix empty string received by .NET 8 users on Linux on userName (logging-log4net)

2024-10-24 Thread via GitHub


gdziadkiewicz commented on PR #199:
URL: https://github.com/apache/logging-log4net/pull/199#issuecomment-2436440550

   I added the unit test and tested on Windows.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Fix empty string received by .NET 8 users on Linux on userName (logging-log4net)

2024-10-24 Thread via GitHub


gdziadkiewicz commented on code in PR #199:
URL: https://github.com/apache/logging-log4net/pull/199#discussion_r1815767370


##
src/log4net/Core/LoggingEvent.cs:
##
@@ -742,15 +742,27 @@ private static string ReviseThreadName(string? threadName)
   {
 if (_platformDoesNotSupportWindowsIdentity)
 {
-  // we've already received one PlatformNotSupportedException
+  // we've already received one PlatformNotSupportedException or null from 
TryReadWindowsIdentityUserName
   // and it's highly unlikely that will change
   return Environment.UserName;
 }
 
 try
 {
-  return _cachedWindowsIdentityUserName ??=
-  TryReadWindowsIdentityUserName();
+  if(_cachedWindowsIdentityUserName is not null)
+  {
+return _cachedWindowsIdentityUserName;
+  }
+  else if(TryReadWindowsIdentityUserName() is string userName)
+  {
+_cachedWindowsIdentityUserName = userName;
+return _cachedWindowsIdentityUserName;
+  }
+  else
+  {
+_platformDoesNotSupportWindowsIdentity = true;
+return Environment.UserName;

Review Comment:
   Done



##
src/log4net/Core/LoggingEvent.cs:
##
@@ -742,15 +742,27 @@ private static string ReviseThreadName(string? threadName)
   {
 if (_platformDoesNotSupportWindowsIdentity)
 {
-  // we've already received one PlatformNotSupportedException
+  // we've already received one PlatformNotSupportedException or null from 
TryReadWindowsIdentityUserName
   // and it's highly unlikely that will change
   return Environment.UserName;
 }
 
 try
 {
-  return _cachedWindowsIdentityUserName ??=
-  TryReadWindowsIdentityUserName();
+  if(_cachedWindowsIdentityUserName is not null)
+  {
+return _cachedWindowsIdentityUserName;
+  }
+  else if(TryReadWindowsIdentityUserName() is string userName)

Review Comment:
   Done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Bump spring-boot.version from 3.3.4 to 3.3.5 [logging-log4j-samples]

2024-10-24 Thread via GitHub


github-actions[bot] merged PR #209:
URL: https://github.com/apache/logging-log4j-samples/pull/209


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Fix empty string received by .NET 8 users on Linux on userName (logging-log4net)

2024-10-24 Thread via GitHub


gdziadkiewicz commented on PR #199:
URL: https://github.com/apache/logging-log4net/pull/199#issuecomment-2436440148

   My plan was to find the answers alone, without using your time :D Thank you 
for the research!
   
   > Do you mean switching from net462 to net471 or adding a comment in the 
code?
   
   Current code guarding the code is `#if !NET462_OR_GREATER` which, combined 
with us targeting net462 and netstandard20,  means we won't include the call in 
any classic .net framework, only netstandard20. That works , but the way 
matching the docs would to only exclude it in net462 (cause that's where it is 
missing). Right now it doesn't matter, but if we retarget to net472 or 
something in the future that call which could be used there to check the OS 
easily will be excluded. So changing the #if would be future-proofing.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Create `DefaultLayout` independent of `PatternLayout` (logging-log4j2)

2024-10-24 Thread via GitHub


vy commented on code in PR #3118:
URL: https://github.com/apache/logging-log4j2/pull/3118#discussion_r1814490921


##
log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java:
##
@@ -49,4 +61,60 @@ public DefaultConfiguration() {
 
 @Override
 protected void doConfigure() {}
+
+static Layout createDefaultLayout() {
+return new DefaultLayout();
+}
+
+/**
+ * A simple layout used only by {@link DefaultConfiguration}
+ * 
+ *   This layout allows to create applications that don't contain {@link 
org.apache.logging.log4j.core.layout.PatternLayout}
+ *   and all its patterns, e.g. GraalVM applications.
+ * 
+ */
+private static final class DefaultLayout extends AbstractLayout {
+
+private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
+
+private final FixedDateFormat dateFormat = 
FixedDateFormat.create(FixedFormat.ABSOLUTE);

Review Comment:
   Can you use `DateTimeFormatter`, please? I am working on nuking both 
`FixedDateFormat` and `FastDateFormat`.



##
log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java:
##
@@ -49,4 +61,60 @@ public DefaultConfiguration() {
 
 @Override
 protected void doConfigure() {}
+
+static Layout createDefaultLayout() {

Review Comment:
   Why do we need to publish `DefaultLayout` like this? Can't `DefaultLayout` 
simply be an individual package-private class in `.core.config` package where 
`AbstractConfiguration` accesses it via `DefaultLayout.INSTANCE`? I mean, given 
`DL` is only used by `AC`, I don't see the reason to contain it in `DC`.



##
log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java:
##
@@ -49,4 +61,60 @@ public DefaultConfiguration() {
 
 @Override
 protected void doConfigure() {}
+
+static Layout createDefaultLayout() {
+return new DefaultLayout();
+}
+
+/**
+ * A simple layout used only by {@link DefaultConfiguration}
+ * 
+ *   This layout allows to create applications that don't contain {@link 
org.apache.logging.log4j.core.layout.PatternLayout}
+ *   and all its patterns, e.g. GraalVM applications.
+ * 
+ */
+private static final class DefaultLayout extends AbstractLayout {

Review Comment:
   Is there any way we can reuse logic from `StatusData#getFormattedStatus()` 
or `SimpleLogger`? That is, instead of creating yet another primitive event 
formatter, maybe we can reuse something already there in the `log4j-api`?



##
log4j-core/src/main/java/org/apache/logging/log4j/core/config/DefaultConfiguration.java:
##
@@ -49,4 +61,60 @@ public DefaultConfiguration() {
 
 @Override
 protected void doConfigure() {}
+
+static Layout createDefaultLayout() {
+return new DefaultLayout();
+}
+
+/**
+ * A simple layout used only by {@link DefaultConfiguration}
+ * 
+ *   This layout allows to create applications that don't contain {@link 
org.apache.logging.log4j.core.layout.PatternLayout}
+ *   and all its patterns, e.g. GraalVM applications.
+ * 
+ */
+private static final class DefaultLayout extends AbstractLayout {
+
+private static final byte[] EMPTY_BYTE_ARRAY = new byte[0];

Review Comment:
   Do we really need this optimization? Can't we simply inline `new byte[0]` to 
call sites?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Add separate reproducibility check workflow [logging-parent]

2024-10-24 Thread via GitHub


ppkarwasz commented on PR #271:
URL: https://github.com/apache/logging-parent/pull/271#issuecomment-2434636374

   Before reviewing this, please check #270  on which this PR is based.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Run integration tests after each deployment (logging-log4j2)

2024-10-24 Thread via GitHub


ppkarwasz commented on PR #3105:
URL: https://github.com/apache/logging-log4j2/pull/3105#issuecomment-2434613030

   This workflow completed the reproducibility tests in this PR correctly: 
https://github.com/apache/logging-log4j2/actions/runs/11386725748


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] file scoped namespaces and CA warnings fixed in examples (logging-log4net)

2024-10-24 Thread via GitHub


FreeAndNil merged PR #202:
URL: https://github.com/apache/logging-log4net/pull/202


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Avoid levels like `INFO#org.apache.log4j.Level` (logging-log4j2)

2024-10-24 Thread via GitHub


ppkarwasz merged PR #3085:
URL: https://github.com/apache/logging-log4j2/pull/3085


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Enable Microsoft.CodeAnalysis.NetAnalyzers (logging-log4net)

2024-10-24 Thread via GitHub


FreeAndNil merged PR #201:
URL: https://github.com/apache/logging-log4net/pull/201


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Avoid levels like `INFO#org.apache.log4j.Level` (logging-log4j2)

2024-10-24 Thread via GitHub


ppkarwasz commented on PR #3085:
URL: https://github.com/apache/logging-log4j2/pull/3085#issuecomment-2434469644

   @jonasrutishauser,
   
   Thank You for your contribution!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Enable Microsoft.CodeAnalysis.NetAnalyzers (logging-log4net)

2024-10-24 Thread via GitHub


ppkarwasz commented on code in PR #201:
URL: https://github.com/apache/logging-log4net/pull/201#discussion_r1814394802


##
src/log4net.Tests/Appender/AdoNet/Log4NetCommand.cs:
##
@@ -24,7 +24,7 @@
 
 namespace log4net.Tests.Appender.AdoNet;
 
-public class Log4NetCommand : IDbCommand
+internal sealed class Log4NetCommand : IDbCommand

Review Comment:
   Just a curiosity: isn't this a breaking change?
   At least it would be a breaking change in Java.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Enable Microsoft.CodeAnalysis.NetAnalyzers (logging-log4net)

2024-10-24 Thread via GitHub


FreeAndNil commented on code in PR #201:
URL: https://github.com/apache/logging-log4net/pull/201#discussion_r1814398417


##
src/log4net.Tests/Appender/AdoNet/Log4NetCommand.cs:
##
@@ -24,7 +24,7 @@
 
 namespace log4net.Tests.Appender.AdoNet;
 
-public class Log4NetCommand : IDbCommand
+internal sealed class Log4NetCommand : IDbCommand

Review Comment:
   Yes, but this is in our test assembly and we don't ship it ;-)
   This class should better be named MockDbCommand - I will change it in my 
next PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org