SQLScript , writing messages to log file

Hi,
We're developing SQLScript and executing them directly on Unix via Unix command HDBSQL. We use the -o keyword with HDBSQL to write messages like comments, custom errors into a log file. The only way we know how to force custom messages into the log file is the SELECT "Text" FROM DUMMY.
Now our SQL consists of multiple procedures that may be called in a nested fashion i.e Proc 1 calls Proc 2 which in turn calls Proc 3. We noticed that the SELECT FROM DUMMY way of writing comments into the log only works if the procedure is the first procedure in the line of nested calls(Proc 1). SELECT FROM DUMMY from a  sub/nested procedure does not make it to the log file.
Is there any other way we can achieve this? Other DBs have options like DBMS.output which work well in such scenarios.
I would like to thank this group for being ever so helpful in all the issues we have faced so far.
Regards,
Nehal

Hello,
I do not agree. have you taken a look at Oracle9i Supplied PL/SQL Packages and Types Reference?
You can use UTL_FILE and DBMS_OUTPUT to achieve exactly what you want.
Rgds
Fidel

Similar Messages

  • Writing messages to log file from database procedures

    Folks,
    Is there a way by which I will be able to write messages from a database procedure to a log file? I would like to know what a procedure is doing and if it has failed or suceeded just as we do in a Unix shell script where we can direct messages to a file.
    e.g. echo 'step 34 completed' >> $X_LOG
    Is there a log file in Oracle where we can check if a procedure has failed and what was the error. I am using Oracle 9i.
    Thanks.

    Hello,
    I do not agree. have you taken a look at Oracle9i Supplied PL/SQL Packages and Types Reference?
    You can use UTL_FILE and DBMS_OUTPUT to achieve exactly what you want.
    Rgds
    Fidel

  • Printing messages in Log File and Output File using Dbms_output.put_line

    Hi,
    I have a requirement of printing messages in log file and output file using dbms_output.put_line instead of fnd_file.put_line API.
    Please let me know how can I achieve this.
    I tried using a function to print messages and calling that function in my main package where ever there is fnd_file.put_line. But this approach is not required by the business.
    So let me know how I can achieve this functionality.
    Regards
    Sandy

    What is the requirement that doesn't allow you using fnd_file.put_line?
    Please see the following links.
    https://forums.oracle.com/forums/search.jspa?threadID=&q=Dbms_output.put_line+AND+Log+AND+messages&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    https://forums.oracle.com/forums/search.jspa?threadID=&q=%22dbms_output.put_line+%22+AND+concurrent&objID=c3&dateRange=all&userID=&numResults=15&rankBy=10001
    Thanks,
    Hussein

  • Syslogd -u not writing network messages to log file

    i'm trying to get remote logging of airport bs debug level log message to work.
    the airport bs it's doing it's part according to tcpdump:
    # tcpdump -i en1 port syslog
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on en1, link-type EN10MB (Ethernet), capture size 96 bytes
    11:56:39.332886 IP 10.0.1.1.syslog > 10.0.1.198.syslog: SYSLOG local0.notice, length: 71
    12:01:10.037655 IP 10.0.1.1.syslog > 10.0.1.198.syslog: SYSLOG local0.notice, length: 71
    12:07:57.786033 IP 10.0.1.1.syslog > 10.0.1.198.syslog: SYSLOG local0.debug, length: 100
    etc...
    config looks appropriate in /etc/syslog.conf:
    local0.* /var/log/appfirewall.log
    and the log file exists.
    the syslog launchctl file says:
    <string>/usr/sbin/syslogd</string>
    <string>-u</string>
    <string>-c 7</string>
    and ps confirms that the options are working:
    /usr/sbin/syslogd -u -c 7
    but the log messages i see arriving from the bs aren't being written to the log file and don't see a network socket for the udp receiver in the netstat -a output.
    i suspect that syslogd configuration may have been moved out of /etc and the airport help topics haven't been updated to reflect the new methods.
    any ideas or pointers?

    i found the answer. there's a section at the end of /System/Library/LaunchDaemons/com.apple.syslogd.plist that needs uncommenting to enable the udp listener.

  • Reading and Writing to a Log file

    Hello,
    I'm writing a class that will write a user id to a log file every time they click on a particular button. However, I don't want a new line every time a user clicks on the button, I'd like to be able to find their id in the log, increment a counter and write that back to the log in place of the previous entry.
    For example, User A clicks on the button for the first time so I write in the log:
    User A 1
    Next time they come along, I want to see if User A exists in the log - which they do - add 1 to the counter and replace User A 1 with User A 2. So the log will now say:
    User A 2
    I was thinking of writing to the log, reading the log back in to a HashMap and then writing the HashMap out every time. Seems like a rather inefficient solution. Is there anything else I can do?
    Thanks!

    Hi,
    counters are a standard topic. Many solutions are to be found in
    textbooks. Here is one of them (Hunter & Crawford Java Servlet
    Programming):
    String activeUser = ... ;
    try
      FileReader fileReader = new FileReader( "mylog" );
      BufferedReader bufferedReader = new BufferedReader(fileReader);
      FileWriter fileWriter = new FileWriter("mylog.new");
      BufferedWriter bufferedWriter = new BufferedWriter( fileWriter );
      String line;
      String user;
      String count;
      while((line = bufferedReader.readLine() != null )
        StringTokenizer tokenizer = new StringTokenizer( line );
        if( tokenizer.countTokens != 2 ) continue; // bogus line
        user = tokenizer.nextToken;
        if( activeUser.equals( user ) )
          count = tokenizer.nextToken;
          bufferedWriter.write(user+" "+(Integer.parseInt(count)+1)+"\n" );
        else
          bufferedWriter.write( line );
      bufferedWriter.close();
      fileWriter.close();
      bufferedReader.close();
      fileReader.close();
      File oldLog = new File("mylog");
      File newLog = new File("mylog.new");
      newLog.renameTo(oldLog);
    catch( Exception e )
        // do whatever appropriate
    }Have fun,
    Klaus

  • Show RMAN  message in log file and screen at same time

    Is there any way I can save all RMAN message in a log file and also show on standar out (screen).
    Thanks

    Hi,
    You can try a shell script like this if you are using linux:
    #!/bin/sh
    # Name: test_backup
    # Author: Tad_cs
    # Description: Executes backup using the RMAN
    export ORACLE_HOME=$1
    export ORACLE_SID=$2
    export LOG_DIR=$3
    # Variables:
    SCRIPT="test_backup"
    data_log=`date '+%y-%m-%d_%H:%M:%S'`
    logfile=${LOG_DIR}/${SCRIPT}-${data_log}.log
    # Execution of script backup of rman:
    $ORACLE_HOME/bin/rman <<EOF > $logfile
    connect target rman/rman
    connect catalog rman/rman
    run { execute script test_backup; }
    EOF
    exitSo, While the script is performing, you can open other screen, search for
    the log that is generating, and see the contents using:
    tail -f log_file_name.logIs this you need?
    []´s

  • Write error messages in log file.

    Hi,
    I want to use a log file to store messages instead of server log. Can anybody give me idea.
    Thankyou.....

    Hi, could DBA check MS SQL Server connection logs???
    May be server has some limits (for example sessions, memory and e.t.c.)

  • Job console messages in log file

    Hi All,
    Is there a log file which logs the job console messages...where is it located ...we are on V11.1.2.,,....We have a issue with Job console validation......when a EPMA planning application is validated...it has some errors....but when we try to open the attachment to get more details...a new window opens and closes immediatly...
    how can we check the error messages?

    In IE try going to Internet Options > Security > Custom Level > Downloads > File Downloads > enable
    This should allow the text file to open when you try to open the attachment.
    Cheers
    John
    http://john-goodwin.blogspot.com/

  • Warning 11 message in log files

    I had Sun One Identity Synchronization for Windows working with AD. I removed the Message Queue when I upgrade another DS on the machine which broke the Idsync. I have reinstalled the packages for IMS3_0_1 that I removed. The Message Queue is starting and appears to be loading the correct data. However, when I do a /etc/init.d/isw start, the Idsync does not come up and I get the following error messages in isw watchdog error.log file:
    [07/Jan/2005:15:53:42.351 -0700] INFO 10 "Log opened. Identity Synchronization for Windows build 2004.100.1537. Java runtime version is 1.4.2_04."
    [07/Jan/2005:15:53:42.398 -0700] WARNING 11 m1ldap "The WatchDog failed to start process [Process Id [1105138422385] Name [CNN101] Execution Interval [60000] ]"
    [07/Jan/2005:15:53:42.401 -0700] WARNING 11 m1ldap "The WatchDog failed to start process [Process Id [1105138422388] Name [Central Logger] Execution Interval [60000] ]"
    [07/Jan/2005:15:53:42.410 -0700] WARNING 11 m1ldap "The WatchDog failed to start process [Process Id [1105138422387] Name [System Manager] Execution Interval [60000] ]"
    [07/Jan/2005:15:53:42.413 -0700] WARNING 11 m1ldap "The WatchDog failed to start process [Process Id [1105138422386] Name [CNN100] Execution Interval [60000] ]"
    I have another instance of Idsyc running, and have started the Message Queue using -verbose to compare if the two are starting the same and they are. Would anyone be able to tell me what the Warning 11 messages mean?
    Thanks
    Randy

    Okay, this is resolved. I moved the jdk to another directory as well in an attempt to do some house cleaning. I thought I had made the necessary changes in all the right places. Just for the fun of it, I made a copy of the jdk to the original directory then everything started working again. So I am guessing that the Warning 11 message must mean that there is not a valid java executable for the components and subcomponenets to start.
    Well, that saves me a weekend of work. Now onto other things!
    Thanks
    Randy

  • Pptp error messages in log-files.

    Hi!
    I've got internet connection from my provider via VPN. After configuring network (article  Microsoft VPN client setup with pptpclient) internet works, but many error messages appears in daemon.log and messages.log like that:
    Jan  2 17:21:40 localhost pptp[4510]: anon log[decaps_gre:pptp_gre.c:414]: buffering packet 1541962 (expecting 1541920, lost or reordered)
    Jan  2 17:21:40 localhost pptp[4510]: anon log[decaps_gre:pptp_gre.c:414]: buffering packet 1541963 (expecting 1541920, lost or reordered)
    Jan  2 17:21:40 localhost pptp[4510]: anon log[decaps_gre:pptp_gre.c:414]: buffering packet 1541964 (expecting 1541920, lost or reordered)
    Jan  2 17:21:40 localhost pptp[4510]: anon log[decaps_gre:pptp_gre.c:414]: buffering packet 1541965 (expecting 1541920, lost or reordered)
    Jan  2 17:21:40 localhost pptp[4510]: anon log[decaps_gre:pptp_gre.c:414]: buffering packet 1541966 (expecting 1541920, lost or reordered)
    Jan  2 17:21:40 localhost pptp[4510]: anon log[decaps_gre:pptp_gre.c:414]: buffering packet 1541967 (expecting 1541920, lost or reordered)
    After a few days this two log files are bigger then 2Gb. Could you please help me find out the reason of this messages?
    Best regards.

    Hi, Joerg. Welcome to the Discussions.
    1. re: Smart Crash Reports error. "Smart Crash Reports" is an Unsanity hack. Either you installed it or it was perhaps installed by another of their hacks you have installed. In either case, that's a question for Unsanity to answer.
    2. re: The SpeedTools extension you cited. Check their documentation or their Web site for instructions on uninstalling the extension. You may be able to start up in Safe Mode (which prevents third-party kernel extensions from loading), then drag it from the Macintosh HD > System > Library > Extensions folder to your desktop, then restart your Mac. However, I'd check the SpeedTools documentation first. See my "Uninstalling applications" FAQ for important advice on uninstalling software.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X
    Note: The information provided in the link(s) above is freely available. However, because I own The X Lab™, a commercial Web site to which some of these links point, the Apple Discussions Terms of Use require I include the following disclosure statement with this post:
    I may receive some form of compensation, financial or otherwise, from my recommendation or link.

  • CSS 11800 show many server up/down message in log file

    My customer use css 11800 running 6.10 Build 304 software for server load-blance
    I config default http keepalive to probe the server status like below.
    service WWW2
    ip address 163.29.x.x
    keepalive type http
    active
    service WWW3
    ip address 163.29.x.x
    keepalive type http
    active
    Since last week,I found many server up/down message in sys.log file
    SEP 20 01:22:36 7/1 1145 NETMAN-2: Enterprise:Service Transition:dpsvr2 -> down
    SEP 20 01:22:41 7/1 1146 NETMAN-2: Enterprise:Service Transition:amd52 -> down
    SEP 20 01:24:26 7/1 1147 NETMAN-5: Enterprise:Service Transition:amd52 -> alive
    SEP 20 01:24:56 7/1 1148 NETMAN-5: Enterprise:Service Transition:dpsvr2 -> alive
    SEP 20 03:20:06 7/1 1149 NETMAN-2: Enterprise:Service Transition:WWW3 -> down
    SEP 20 03:20:16 7/1 1150 NETMAN-5: Enterprise:Service Transition:WWW3 -> alive
    SEP 20 07:00:57 7/1 1151 NETMAN-2: Enterprise:Service Transition:www5 -> down
    SEP 20 07:01:11 7/1 1152 NETMAN-5: Enterprise:Service Transition:www5 -> alive
    The server status change down to up,almost during 20 sec only,and We can access the server without any problem at the same time
    Does this is a software bug.If not,How do I trace this problem,thks!!

    capture a sniffer trace to see exactly what's going on.
    Going to the server with a browser may work because using GET/POST method, but the CSS configured the way you did will use a HEAD method which could be a problem for your server.
    The server could be slow to respond as well.
    Try to increase the keepalive frequence since the timeout is linked to the frequency.
    Finally, you may want to configure a url to poll with the command 'keepalive uri .....'
    Once again, by simply sniffing between the CSS and the server, you will know exactly where is the problem.
    Gilles.

  • How to Write Soap Message to Log File

    Hello users,
    Is there a config setting that causes soap messages to be written to the server log. I'm using JBoss/Turnkey. I found a reference in the JBoss documentation (Ch 5 J2EE Web Services) that offers this guidance:
    (5.4. Monitoring webservices requests)
    When processing web services requests, it is often useful to be able to observe the actual messages being passed between the client and the server. JBoss logs this information in the org.jboss.axis.transport.http.AxisServlet category.
    To enable web services logging, add the following debug category to the log4j.xml file:
    <category name="org.jboss.axis.transport.http.AxisServlet">
    <priority value="DEBUG"/>
    </category>
    When enabled, all SOAP requests and responses will be logged to the server.log file.
    Tried it but not working yet. Thanks for any help.
    Jesse

    http://www.google.com/search?q=java+web+service+tutorial&meta=

  • Writing to a log file.

    I have written the following code. Also, by going through
    the archives, many have written the similar way and were successful. The problem I have is, the log file is empty. Where am I missing something?
    Thanks
    Sriram
    <code>
    import java.util.Calendar;
    import java.io.*;
    public class debugTest{
    public static void main(String args[]) throws Exception {
    String logFileDirString = "C:\\projects\\javaapp\\log\\tradematch\\";
    String logFileName = getLogFileName(logFileDirString);
    System.out.println("The log file name" + logFileName);
    File logFileDir = new File(logFileDirString);
    if (!logFileDir.exists()){ logFileDir.mkdirs(); }
    File logFile = new File(logFileName);
    if (!logFile.exists()){ logFile.createNewFile(); }
    FileOutputStream fops = new FileOutputStream(logFile.getName(), true);
    PrintStream ps = new PrintStream(fops);
    System.setOut(ps);
    System.out.println("Line 1");
    System.out.println("Line 2");
    ps.close();
    public static String getLogFileName(String logFileDirString) {
    Calendar rightNow = Calendar.getInstance();
    //Month is 0 based. Added 1 to make it 1 based. Subtracted by Calendar.JANUARY, so that
    //it takes care if it ever becomes 1 based.
    Integer theMonth = new Integer((rightNow.get(rightNow.MONTH) + 1 - Calendar.JANUARY));
    String theMonthString = theMonth.toString();
    if (theMonthString.length() < 2) theMonthString = "0" + theMonthString;
    Integer theDayOfMonth = new Integer(rightNow.get(rightNow.DAY_OF_MONTH));
    String theDayOfMonthString = theDayOfMonth.toString();
    if (theDayOfMonthString.length() < 2) theDayOfMonthString = "0" + theDayOfMonthString;
    Integer theYear = new Integer(rightNow.get(rightNow.YEAR));
    String theYearString = theYear.toString();
    String theLogFileString = logFileDirString.concat(theMonthString).concat(theDayOfMonthString)
    .concat(theYearString).concat(".txt");
    return theLogFileString;
    </code>

    Use this:
    <pre>
    FileOutputStream fops = new FileOutputStream(logFile.getAbsolutePath() , true);
    System.out.println( logFile.getAbsolutePath() );
    </pre>

  • Writing to servlet log files?

    Using the log(...) method of the servlet API. No problem finding the log file in the case of the embedded server in JDev. I cannot find the log file in the standalone OC4J. Seems to me there is an XML attribute to 'turn-on' to enable logging but I do not remember it.
    Please send me info to enable logging -
    THANKS - Ken Cooper

    The string written to standalone log file does not exist anywhere in the JDev installation folder!Do you mean your oc4j standalone installation is inside you Jdev installation? I am so confused.
    As far as I checked, the servlet log(...) should go to the log file for the j2ee application, which is by default, application.log in application-deployments/yourApp directory. It did in my simple test.

  • Is there any downside to writing plain old log files?

    Hi all;
    We have our web & worker roles using log4net to write log files to disk. It works great where we then remote desktop in and go to the folder where they are and we've got exactly what we want - a daily log file for each worker.
    Is there any downside to this approach?
    Also, is there an easy way to have it delete all log files over a month old?
    thanks - dave
    What we did for the last 6 months -
    Made the world's coolest reporting & docgen system even more amazing

    hi dave,
    If you stored the log file on instances disk, you may get them using the RDP. But if you redeployed ,auto-scaled the cloud service, the log file maybe removed. So I don't recommend you storage the content on Azure instances disk.
    If you stored the log file on Azure Blob/Table storage (https://github.com/crossvertise/log4net.Appender.AzureBlobStorage/tree/master/TransactionLogger),
    you could view it using some tool,such as Azure server explore and Azure storage Explore. And Azure storage will backup your storage data well.
    >>Also, is there an easy way to have it delete all log files over a month old?
    If you storage on azure storage, the one approach is that you could remove it manually . Another approach is that you could create a service on your project. And then you could create a Job using Scheduler service (http://msdn.microsoft.com/library/azure/dn479785.aspx
    ).  If you don't like to use the Scheduler service, you could coding a delete log data or file method and execulted  this method every day.
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

Maybe you are looking for