consoleExecutionLog doesn't log to the console

Description

https://github.com/lucee/Lucee/blob/6.2/core/src/main/java/lucee/runtime/engine/ConsoleExecutionLog.java#L50

protected void _init(PageContext pc, Map<String, String> arguments) { this.pc = pc; if (pw == null) { // stream type String type = arguments.get("stream-type"); if (type != null && type.trim().equalsIgnoreCase("error")) pw = new PrintWriter(System.err); else pw = new PrintWriter(System.out); } } @Override protected void _log(int startPos, int endPos, long startTime, long endTime) { long diff = endTime - startTime; LogUtil.log(pc, Log.LEVEL_TRACE, Controler.class.getName(), pc.getId() + ":" + pc.getCurrentPageSource().getDisplayPath() + ":" + positons(startPos, endPos) + " > " + timeLongToString(diff)); }

it sets up a printWriter which is never used, but the logging is using the logUtil which requires a log to be created with the correct trace level, otherwise it does nothing

here is some code to quickly generate an execution log (doesn’t work due to the logging)

// log out execution Log admin action="UpdateExecutionLog" type="server" password="admin" class="lucee.runtime.engine.ConsoleExecutionLog" enabled= true arguments={ "stream-type": "out", "unit": "milli", "min-time": 100, "snippet": true }; admin action="getExecutionLog" type="server" password="admin" returnVariable="exeConfig"; admin action="getDebug" type="server" password="admin" returnVariable="debugConfig"; admin action="updateDebug" type="server" password="admin" debug="true"; // systemOutput(exeConfig, true); // systemOutput(debugConfig, true); systemOutput( "--- executionLog START [#template#]---", true); _internalRequest( template: template ); systemOutput( "--- executionLog END ---", true); admin action="updateDebug" type="server" password="admin" debug="false"; admin action="UpdateExecutionLog" type="server" password="admin" arguments={} class="lucee.runtime.engine.ConsoleExecutionLog"enabled=false;

Activity

Show:

Pothys - MitrahSoft 6 January 2025 at 13:12

, I tested this ticket with Lucee version 6.2.0.267-SNAPSHOT. After creating the debugging logs, I checked the console log execution, and the log files were successfully recorded on the console. No issues were encountered, and it works as expected in lucee latest version.

Zac Spitzer 18 December 2024 at 17:36

Refactored this class to only handle console logging, moved the log stuff into LogExecutionLog and added support to specify log level and log name

Zac Spitzer 17 December 2024 at 16:15

I think will like this 🙂

Zac Spitzer 17 December 2024 at 15:55

The CFC snippets are incorrect due to https://luceeserver.atlassian.net/browse/LDEV-5207

Fixed

Details

Assignee

Reporter

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Fix versions

Priority

Created 17 December 2024 at 11:34
Updated 15 January 2025 at 08:08
Resolved 6 January 2025 at 13:12

Flag notifications