Feature Request: Always store HTTP Request/Response regardless of log level #855
-
I have specific requirements for always storing the HTTP Request and Response data, and I’m trying to see if my existing NebulaLogger setup can handle this. Right now, I know there are methods like setHttpRequestDetails(...) and setHttpResponseDetails(...), which correctly capture what I need. However, these methods are usually tied to a given log level. My need is to always log the HTTP request and response, regardless of the current logger settings or log level. Is there a way to do something like Logger.http("logging an HTTP request").setHttpRequestDetails(...) that would bypass or override the log level settings so this data is always captured? If not, is there a recommended approach for implementing such a feature? Thanks for any insight or suggestions! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 8 replies
-
Hi @jvega-intakedesk - you should be able to do this already with any log entry, using one of the overloads for Here's an example of how to use it: // You can decide if the the log entry is always saved (by always setting it to true),
// or if you could use some custom logic to determine the boolean value.
Boolean shouldSave = true;
Logger.newEntry(System.LoggingLevel.FINEST, 'Another Message', shouldSave)
.setHttpRequestDetails(new System.HttpRequest());
Logger.saveLog(); Hope this helps, but let me know if you have any follow up questions! |
Beta Was this translation helpful? Give feedback.
-
@jongpie – I believed I had tested this, but the developers noticed that although newEntry's shouldSave method allows inserting into the log's buffer by bypassing the log level, the platform event subscriber appears to run another check in filterLogEntryEventsToSave, ensuring the logging level matches. As a result, the log entry isn’t actually saved. Is this expected? If so, are there any other options to persist the entry regardless of the log level setting? |
Beta Was this translation helpful? Give feedback.
Hi @jvega-intakedesk - you should be able to do this already with any log entry, using one of the overloads for
Logger.newEntry()
. Essentially, you provide a boolean value to indicate if the log entry should be saved (regardless of the user's configured logging level).Here's an example of how to use it:
Hope this helps, but let me know if you have any follow …