Routines in DBMS_SYSTEM package
The following routines can be used to write vital information to Alerts and Trace files.
- KSDIND:
Does an indent in the form of inserting colons (:) before the next write is carried out. The indent levels are from 0 to 30. This option could be used to separate the custom messages from the existing oracle messages. For example, I could search the Alert Log for messages starting with 5 colons to identify Application generated messages. The default is 0. This process fails to work in some cases (mentioned below). As a safety, I also add a standard prefix to all messages to identify application related messages. - KSDWRT:
Writes a message to the alert file. The first parameter DEST takes input as 1 (write to trace file), 2 (write to alert log) or 3 (write to both trace and alert log files). The second parameter TST is the actual text message that should go into the file(s).
Example
SQL> exec dbms_system.ksdwrt(2, 'testing for alert log writing');
http://www.dbasupport.com/oracle/ora9i/custom_messages.shtml