Logger icon indicating copy to clipboard operation
Logger copied to clipboard

ER: Indention of lines

Open JuergenSchuster opened this issue 8 years ago • 5 comments

I would like to have a parameter where the text of the log output is idented (default 2). So it should look like the example below. And no I don't want to add spaces manually to my log text every time :-)

START myroutine   my first log output   my second log output   ...50 more END myroutine

JuergenSchuster avatar Oct 20 '16 05:10 JuergenSchuster

Yep.

It would be preferable to have a numeric "stack depth" column added - this way, you can lpad the log text with whatever number of spaces or tabs you want.

Each call starting with "START " should increment the counter. Each call starting with "END " should decrement the counter without going below zero.

jeffreykemp avatar Oct 20 '16 06:10 jeffreykemp

I agree with @jeffreykemp suggestion of a "stack depth" column.

While Logger's primary intent seems to be just recording something descriptive that is debug or error related, things like this "stack depth" and the "empty lines" mentioned in #183 would be beneficial in reporting or printing.

zhudock avatar Oct 20 '16 12:10 zhudock

In 12c we can use utl_call_stack.DYNAMIC_DEPTH to provide that information. However since the logger internal calls adds to this number, it should be reduced by a few values.

SvenWeller avatar Oct 25 '16 17:10 SvenWeller

I've tagged this as a future item. I agree it would be a nice feature to have and maybe something we only provide for 12c onwards unless there's an easy way to detect in 11g.

I think this would be best done by adding a preference to the logger_prefs table and not an additional parameter to the standard logger.log calls.

martindsouza avatar Oct 26 '16 04:10 martindsouza

The main problem is how to increase and decrease the stack depth. In one project I use code similar to this, to get the same result.

g_trc varchar2(1000); -- blank trace
  procedure trcAdd is
  begin
    g_trc := g_trc || '..';
  end trcAdd;

  procedure trcSub is
  begin
    g_trc := substr(g_trc,1,length(g_trc)-2);
  end trcSub;

and then call trcAdd and trcSub always at the beginning and at the end of a module.

trcAdd;
    pk_myModule.logParams(v_module, g_trc||'call a('||x||','||y||')');
  ...
trcSub;

With 12c this could be calculated and stored automatically.

SvenWeller avatar Mar 01 '17 15:03 SvenWeller