Reg:printing contents to log file
Hello all iam creating a debug log file for my program.. debug will be based on the level set which will be taken as a input from the user ..when i try to print the contents to a file gen.out i could not print anything ..file is empty..can some one pls help me ..there is no error thrown by the program
// my main propram
public class ff {
public static void main(String[] args) {
PrintStream out = System.out;
int dbgLevel = Integer.parseInt(args[1]);
String path ="gen.out";
debug.setLevel(dbgLevel);
try {
debug.setLogFile(path);
catch(Exception e1) {
e1.printStackTrace();
debug.msg(0, "Printing contents to a file ");
if (Debug.allowed(0)) {
Debug.msg(0, "1.printing th econtents );
//debug class
public class debug {
private static int ourLevel = 0;
private static FileWriter c_writer;
private static final String k_nl = System.getProperty("line.separator");
public static void msg(int reqLevel, String debugMessage) {
if (reqLevel <= ourLevel) {
String s = "DBG(" + reqLevel + ") " + getTS() + " " + debugMessage + k_nl;
if (c_writer == null) {
System.out.println("writer is null "+c_writer.toString());
System.err.println(s);
System.err.flush();
else {
System.out.println("writer is not null "+c_writer.toString());
try {
c_writer.write(s);
catch (IOException e) {
e.printStackTrace();
} // if (c_writer...) else ...
} // if (reqLevel...
} // msg()
public static void setLogFile(String path) throws IOException {
c_writer = new FileWriter(path);
public static void setLevel(int l) {
ourLevel = l;
public static boolean allowed(int reqLevel) {
return reqLevel <= ourLevel;
file is getting created but its empty ..wat am i doing wrong here .?
thanks mkoryak got it i was flushing a wrong stream
thanks for the help
Similar Messages
-
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
SandyWhat 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 -
What is the best way to merge a file content into log file
What is the best way to merge a file content into log file.
In worst case, I will read the file line by line as string, then use
logger.info(lineString)to output to log file.
However, is there better way to do this?
The eventual log file will be something like:
log message 1
log message 2
content from file line 1
content from file line 2
content from file line 3
log message 3
log message 4ThanksJohn618 wrote:
Thank you and let me explain:
1. What do you mean by better?
I would like to see better performance. read line by line and log each line as string can be slow. Did you measure this and determine that it is actually a problem for your application? Or are you guessing?
Regardless of what you do you are still going to need to read the file.
>
2.The only better way I can think of is not having to do it, but I assume you have a very good reason to want to do this.
Yes, I have to do it beacuse the requirement is to have that file content be part of logging.
Any idea?How is it supposed to be part of it? For example which of the following is better?
File AAA - contents
First Line
Second Line XXX
Log 1
2009-03-27 DEBUG: Random preceding line
2009-03-27 DEBUG: First Line
2009-03-27 DEBUG: Second Line XXX
2009-03-27 DEBUG: Random following line
Log 2
2009-03-27 DEBUG: Random preceding line
2009-03-27 DEBUG: ----- File: AAA -------------
First Line
Second Line XXX
2009-03-27 DEBUG: Random following lineBoth of the above have some advantages and disadvantages.
The first in a mult-threaded app can end up with intermittent log entries in between lines, so having log lines with thread ids becomes important.
The first can be created by reading one line at a time and posting one at a time.
The second can be created by reading the entire file as a single string and then posting using a single log statement. -
A simple program
Class test
public static void main(String args[])
System.out.println("Working");
When this program is executed, it should not print "Working" in Command Prompt.
Instead it should create a file System.out.log and in that file it should write "working".
How to do it ????Hi
I am giving you this program. hopefully this is the part you need. pls feel free to contact me in case of doubts.
bye
mm
import java.io.*;
public class any {
public static void main(String[] args)
FileOutputStream fos =null;
try
fos = new FileOutputStream(new File("C:\\temp\\Outlog.txt"));
PrintStream p = new PrintStream(fos);
System.setOut(p);
System.out.println("HELLO....");
System.out.println("How R U???");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}finally
try
if(fos!=null)
fos.close();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace(); -
Print contents of a file till a specific number of lines
Hi,
I have some files which have 55,000 or maybe 70,000 lines of text. Out of which I need to print only the first 10,000 lines. I am using this approach but failing:
String data = null;
while((data= br.readLine())!=null){
if(data.equals("")){
//p.println("");
System.out.println("Nothing");
else{
for (int i=0;i<9999;i++){
p.println(data);
}}I know I am wrong because this prints each line 9999 times. How to achieve what I want??I tried this but it also results in the same thing. Each line printed "maxlines" no. of times.
Here is how I used it:
while((data= br.readLine())!=null){
if(data.equals("")){
//p.println("");
System.out.println("Nothing");
//temp[count] = data;
//count++;
else{
int count = 0;
while(count<9999){
System.out.println(data);
count++;
}Can you elaborate on "&& someOtherCondition ..." -
Reg:printing log contents
Hello all iam creating a debug log file for my program.. debug will be based on the level set which will be taken as a input from the user ..when i try to print the contents to a file gen.out i could not print anything ..file is empty..can some one pls help me ..there is no error thrown by the program
// my main propram
public class ff {
public static void main(String[] args) {
PrintStream out = System.out;
int dbgLevel = Integer.parseInt(args[0]);
String path ="gen.out";
debug.setLevel(dbgLevel);
try {
debug.setLogFile(path);
catch(Exception e1) {
e1.printStackTrace();
debug.msg(0, "Printing contents to a file ");
if (Debug.allowed(0)) {
Debug.msg(0, "1.printing th econtents );
//debug class
public class debug {
private static int ourLevel = 0;
private static FileWriter c_writer;
private static final String k_nl = System.getProperty("line.separator");
public static void msg(int reqLevel, String debugMessage) {
if (reqLevel <= ourLevel) {
String s = "DBG(" + reqLevel + ") " + getTS() + " " + debugMessage + k_nl;
if (c_writer == null) {
System.out.println("writer is null "+c_writer.toString());
System.err.println(s);
System.err.flush();
else {
System.out.println("writer is not null "+c_writer.toString());
try {
c_writer.write(s);
catch (IOException e) {
e.printStackTrace();
} // if (c_writer...) else ...
} // if (reqLevel...
} // msg()
public static void setLogFile(String path) throws IOException {
c_writer = new FileWriter(path);
public static void setLevel(int l) {
ourLevel = l;
public static boolean allowed(int reqLevel) {
return reqLevel <= ourLevel;
} file is getting created but its empty ..wat am i doing wrong here .?Where are you writing to the file? I think you are not including important code.
-
How to print only fatal error in log file in tomcat4.1
Hi all ,i m using tomcat4.1
1> i want to print only fatal error in log file ,but it print all thing in log file ,how i can avoid it(because i think this process is consuming my resource)
assume below ip address is corect:
this is exact printing in my log file
.12.2.3.3 - - [24/Oct/2007:00:00:00 5050] "GET /menu/ir.jsp HTTP/1.1" 200 2828
12.2.3.3 - - [24/Oct/2007:00:00:00 5050] "GET /menu/bottomAdv.jsp HTTP/1.1" 200 528
12.2.3.3 - - [24/Oct/2007:00:00:02 5050] "GET /menu/alerts.jsp HTTP/1.1" 200 323
12.2.3.3 - - [24/Oct/2007:00:00:02 5050] "GET /alerts/createAlertShow.jsp HTTP/1.1" 200 26140
123.2.3. - - [24/Oct/2007:00:00:05 5050] "GET /menu/getsensex.jsp HTTP/1.1" 200 642
12.2.3.3 - - [24/Oct/2007:00:00:05 5050] "GET /menu/latestRecommendation.jsp HTTP/1.1" 200 5210
12.2.3.3 - - [24/Oct/2007:00:00:05 5050] "GET /portfolio/watchlist/displayWatchlistItemsShow.jsp?watchlistId=20070509013642953_1&watchlistName=First&refreshRate=900&flag=1 HTTP/1.1" 500 7257
12.2.3.3 - - [24/Oct/2007:00:00:05 5050] "GET /menu/iwealthNewsScroller.jsp HTTP/1.1" 200 2828
112.23.3 - - [24/Oct/2007:00:00:06 5050] "GET /menu/alerts.jsp HTTP/1.1" 200 323
112.23.3 - - [24/Oct/2007:00:00:06 5050] "GET /menu/bottomAdv.jsp HTTP/1.1" 200 528
12.2.3.3 - - [24/Oct/2007:00:00:07 5050] "GET /menu/alerts.jsp HTTP/1.0" 200 323
12.2.3.3 - - [24/Oct/2007:00:00:09 5050] "POST /Transaction/equity/modifyConfirmShow.jsp?DelId=0 HTTP/1.1" 200 28661
12.2.3.3 - - [24/Oct/2007:00:00:09 5050] "GET /menu/getsensex.jsp HTTP/1.1" 200 6422>what will happen if i change timestamp="false" and what is the significance of verbosity="1" or "2" or "3" ,or "4" and what happen if i change debug="1" or other in below code
<Logger className="org.apache.catalina.logger.FileLogger" debug="0" directory="logs" prefix="www.xyz_log." suffix=".txt" timestamp="true" verbosity="4"/>Edited by: Deepak23 on Oct 24, 2007 10:41 PM
Edited by: Deepak23 on Oct 24, 2007 11:16 PMOne of my standard answers (which will explain the use of Directory Objects)...
The UTL_FILE_DIR parameter has been deprecated by oracle in favour of direcory objects because of it's security problems.
The correct thing to do is to create a directory object e.g.:
CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
Then, grant permission to the users who require access e.g....
GRANT READ,WRITE ON DIRECTORY mydir TO myuser;Then use that directory object inside your FOPEN statement e.g.
fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default. -
Parse log file using powershell
Hi,
Am pretty new to Powershell and would require anyone of your assistance in setting up a script which parse thru a log file and provide me output for my requirements below.
I would like to parse the Main log file for Barra Aegis application(shown below) using powershell.
Main log = C:\BARRALIN\barralin.log
Model specific log = C:\BARRALIN\log\WG*.log
Requirements :
1. scroll to the bottom of the log file and look for name called "GL Daily" and see the latest date which in the example log below is "20150203"
note : Name "GL Daily" and date keep changing in log file
2. Once entry is found i would like to have a check to see all 3 entries PREPROCESS, TRANSFER, POSTPROCESS are sucess.
3. If all 3 are success i would like to the script to identify the respective Model specific log number and print it out.
E.g if you see the sample log below for "GL Daily", it is preceded by number "1718" hence script should append the model log path with "WG00" along with 1718, finally it should look something like this C:\BARRALIN\log\WG001718.log.
4. If all 3 items or anyone of them are in "failed" state then print the same log file info with WG001718.log
Any help on this would be much appreciated.
Thank You.
Main log file :
START BARRALINK Check Auto Update 1716
43006 20150203
Trgt/Arch c:\barralin
PREPROCESS success 0 preprocessor: no error
TRANSFER success 1 Host success: files received
POSTPROCESS success 0 Postprocessor: no error
CONFIRMATION success 2 No Confirm needed
STOP 43105 20150203
START Aegis GL Monthly
1716 43117 20150203
Trgt/Arch K:\barraeqr\aegis\qnt\gleqty
PREPROCESS success 0 preprocessor: no error
TRANSFER success 1 Host success: files received
POSTPROCESS success 0 Postprocessor: no error
CONFIRMATION success 2 No Confirm needed
STOP 44435 20150203
START Aegis UB Daily
1717 43107 20150203
Trgt/Arch K:\barraeqr\aegis\qnt\gleqty
PREPROCESS success 0 preprocessor: no error
TRANSFER success 1 Host success: files received
POSTPROCESS success 0 Postprocessor: no error
CONFIRMATION success 2 No Confirm needed
STOP 44435 20150203
START Aegis GL Daily
1718 44437 20150203
Trgt/Arch K:\barraeqr\aegis\qnt\gleqty
PREPROCESS success 0 preprocessor: no error
TRANSFER success 1 Host success: files received
POSTPROCESS success 0 Postprocessor: no error
CONFIRMATION success 2 No Confirm needed
STOP 50309 20150203
Hi All,
I was writing a function in power shell to send email and i was looking to attach lines as and when required to the body of the email. but am not able to get this done..Here's my code
Function Email ()
$MailMessage = New-Object System.Net.Mail.MailMessage
$SMTPClient = New-Object System.Net.Mail.SmtpClient -ArgumentList "mailhost.xxx.com"
$Recipient = "[email protected]"
If ($MessageBody -ne $null)
$MessageBody = "The details of Barra $strsessionProduct model is listed below
`rHostName : $localhost
`r Model Run Date : $Date
`r Model Data Date : $DateList1
`r`n Click for full job log"+ "\\"+$localhost+"\E$\Local\Scripts\Logs "
$MailMessage.Body = $MessageBody
If ($Subject -ne $null) {
$MailMessage.Subject = $Subject
$Sender = "[email protected]"
$MailMessage.Sender = $Sender
$MailMessage.From = $Sender
$MailMessage.to.Add($Recipient)
If ($AttachmentFile -ne $null) { $MailMessage.Attachments.add($AttachmentFile)}
$SMTPClient.Send($MailMessage)
$Subject = "Hello"
$AttachmentFile = ".\barralin.log"
$MessageBody = "Add this line to Body of email along with existing"
Email -Recipient "" -Subject $Subject -MessageBody $MessageBody -AttachmentFile $AttachmentFile
as you can see before calling Email function i did add some lines to $MessageBody and was expecting that it would print the lines for $MessageBody in Email Function along with the new line. But thats not the case.
I have tried to make $MessageBody as an Array and then add contents to array
$MessageBody += "Add this line to Body of email along with existing"
$MessageBody = $MessageBody | out-string
Even this didnt work for me. Please suggest me any other means to get this done.
THank You -
Hi
I Need VDS script in order to change domain client local administrator password in my domain ,and put this script in startup script via group policy, but for security purpose I want to randomize local administrator password and log new password
set for each computer on a text file, I want to over write the old password of eachcomputer in log file with new one in order to have the update log file ,my support team some times need administrator password for troubleshooting.
I need a script for generate randomize administrator password which make log file to recorded new administrator password with associated computer name on it and each time new administrator password set it over write the old record on
the log file and update the content of log file automatically.
RegardsHi
I need a script for generate randomize administrator password which record new password on a log file with associated computer name and each time new administrator password set for a computer it over write the old record
on the log file and update the content of log file automatically.
Regards -
Prevent javax.ejb.EJBException in log file
I am getting javax.ejb.EJBException's in my code when I try to instantiate an EJB with a bad primary key. I have put the instantiation inside of a try catch, and caught the generic "Exception". I have also tried catching the javax.ejb.EJBException.
In both cases I am still getting the javax.ejb.EJBException error message printing in my log files. is there a way to prevent this from printing in the log files?check this thread
Problem in PI 7.11 - SLD -
Parse a log file...
Hi All,
1. I want to parse the content of log file, but when I open the log file it does not show me field names .
it starts with row containing the contents directly, where i want to read and process only three fields randomly.
I have written the code that works on IIS logs, the log i want to parse having field separator ' ' as single white space.
2. Some of log files are zipped, so I am unable to open and read them. so that I can parse them.
can any one have any clue or code that help me out.
thanks!bhatnagarudit wrote:
Hi All,
1. I want to parse the content of log file, but when I open the log file it does not show me field names .
it starts with row containing the contents directly, where i want to read and process only three fields randomly.
I have written the code that works on IIS logs, the log i want to parse having field separator ' ' as single white space.
2. Some of log files are zipped, so I am unable to open and read them. so that I can parse them.
can any one have any clue or code that help me out.
thanks! Here is a suggested algorithm .. (I don't want to write the code for you :-))
You have the following format.
314159b66967d86f031c7249d1d9a8024.. mybucket +[04/Aug/2006:22:34:02 +0000]+ 72.21.206.5 314159b66967d86f031c724... 3E57427F33A59F07 REST.PUT.OBJECT* /photos/2006/08/puppy.jpg +"GET /mybucket/photos/2006/08/puppy.jpg?x-foo=bar"+ 200 NoSuchBucket 2662992 3462992 70 10 "http://www.amazon.com/webservices" "curl/7.15.1"
Read the file in, go thru lines one by one. For each line,
1. Get the content in the first square brackets. Regular Expression: [&].
2. From there, get the fourth (4th) word separated by space.
3. From there, get the content in the first pair of double quotes. Regular Expression: \"&\". -
How do we print the error logs
hi friends , i want to print the error log file of a bdc session method ,can any one sugest me a answer
Check out this Sample Program
*& Report *
*& This program is to transfer data from flat file to transaction 'FD01'
REPORT zgopi_report
NO STANDARD PAGE HEADING
LINE-SIZE 255
MESSAGE-ID ZRASH.
* Internal Table Declarations *
*--Internal Table for Data Uploading.
DATA : BEGIN OF IT_FFCUST OCCURS 0,
KUNNR(10),
BUKRS(4),
KTOKD(4),
ANRED(15),
NAME1(35),
SORTL(10),
STRAS(35),
ORT01(35),
PSTLZ(10),
LAND1(3),
SPRAS(2),
AKONT(10),
END OF IT_FFCUST.
*--Internal Table to Store Error Records.
DATA : BEGIN OF IT_ERRCUST OCCURS 0,
KUNNR(10),
EMSG(255),
END OF IT_ERRCUST.
*--Internal Table to Store Successful Records.
DATA : BEGIN OF IT_SUCCUST OCCURS 0,
KUNNR(10),
SMSG(255),
END OF IT_SUCCUST.
*--Internal Table for Storing the BDC data.
DATA : IT_CUSTBDC LIKE BDCDATA OCCURS 0 WITH HEADER LINE.
*--Internal Table for storing the messages.
DATA : IT_CUSTMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.
DATA : V_FLAG1(1) VALUE ' ',
"Flag used for opening session.
V_TLINES LIKE SY-TABIX,
"For storing total records processed.
V_ELINES LIKE SY-TABIX,
"For storing the no of error records.
V_SLINES LIKE SY-TABIX.
"For storing the no of success records.
* Selection screen *
SELECTION-SCREEN BEGIN OF BLOCK B1.
PARAMETERS : V_FNAME LIKE RLGRAP-FILENAME,
V_SESNAM LIKE RLGRAP-FILENAME.
SELECTION-SCREEN END OF BLOCK B1.
* Start-of-selection *
START-OF-SELECTION.
*-- Form to upload flatfile data into the internal table.
PERFORM FORM_UPLOADFF.
* TOP-OF-PAGE *
TOP-OF-PAGE.
WRITE:/ 'Details of the error and success records for the transaction'
ULINE.
SKIP.
* End of Selection *
END-OF-SELECTION.
*-- Form to Generate a BDC from the Uploaded Internal table
PERFORM FORM_BDCGENERATE.
*--To write the totals and the session name.
PERFORM FORM_WRITEOP.
*& Form form_uploadff
* Form to upload flatfile data into the internal table.
FORM FORM_UPLOADFF .
*--Variable to change the type of the parameter file name.
DATA : LV_FILE TYPE STRING.
LV_FILE = V_FNAME.
*--Function to upload the flat file to the internal table.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = LV_FILE
* FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
DATA_TAB = IT_FFCUST
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC = 0.
*--Deleting the headings from the internal table.
DELETE IT_FFCUST INDEX 1.
*--Getting the total number of records uploaded.
DESCRIBE TABLE IT_FFCUST LINES V_TLINES.
ENDIF.
ENDFORM. " form_uploadff
*& Form Form_bdcgenerate
* Form to Generate a BDC from the Uploaded Internal table
FORM FORM_BDCGENERATE .
*--Generating the BDC table for the fields of the internal table.
LOOP AT IT_FFCUST.
PERFORM POPULATEBDC USING :
'X' 'SAPMF02D' '0105',
' ' 'BDC_OKCODE' '/00' ,
' ' 'RF02D-KUNNR' IT_FFCUST-KUNNR,
' ' 'RF02D-BUKRS' IT_FFCUST-BUKRS,
' ' 'RF02D-KTOKD' IT_FFCUST-KTOKD,
'X' 'SAPMF02D' '0110' ,
' ' 'BDC_OKCODE' '/00',
' ' 'KNA1-ANRED' IT_FFCUST-ANRED,
' ' 'KNA1-NAME1' IT_FFCUST-NAME1,
' ' 'KNA1-SORTL' IT_FFCUST-SORTL,
' ' 'KNA1-STRAS' IT_FFCUST-STRAS,
' ' 'KNA1-ORT01' IT_FFCUST-ORT01,
' ' 'KNA1-PSTLZ' IT_FFCUST-PSTLZ,
' ' 'KNA1-LAND1' IT_FFCUST-LAND1,
' ' 'KNA1-SPRAS' IT_FFCUST-SPRAS,
'X' 'SAPMFO2D' '0120',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0125',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0130',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0340',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0360',
' ' 'BDC_OKCODE' '=ENTR',
'X' 'SAPMF02D' '0210',
' ' 'KNB1-AKONT' IT_FFCUST-AKONT,
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0215',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0220',
' ' 'BDC_OKCODE' '/00',
'X' 'SAPMF02D' '0230',
' ' 'BDC_OKCODE' '=UPDA'.
*--Calling the transaction 'fd01'.
CALL TRANSACTION 'FD01' USING IT_CUSTBDC MODE 'N' UPDATE 'S'
MESSAGES INTO IT_CUSTMSG.
IF SY-SUBRC <> 0.
*--Populating the error records internal table.
IT_ERRCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_ERRCUST.
CLEAR IT_ERRCUST.
*--Opening a session if there is an error record.
IF V_FLAG1 = ' '.
PERFORM FORM_OPENSESSION.
V_FLAG1 = 'X'.
ENDIF.
*--Inserting the error records into already open session.
IF V_FLAG1 = 'X'.
PERFORM FORM_INSERT.
ENDIF.
*--Populating the Success records internal table.
ELSE.
IT_SUCCUST-KUNNR = IT_FFCUST-KUNNR.
APPEND IT_SUCCUST.
CLEAR IT_SUCCUST.
ENDIF.
*--Displaying the messages.
IF NOT IT_CUSTMSG[] IS INITIAL.
PERFORM FORM_FORMATMSG.
ENDIF.
*--Clearing the message and bdc tables.
CLEAR : IT_CUSTBDC[],IT_CUSTMSG[].
ENDLOOP.
*--Getting the total no of error records.
DESCRIBE TABLE IT_ERRCUST LINES V_ELINES.
*--Getting the total no of successful records.
DESCRIBE TABLE IT_SUCCUST LINES V_SLINES.
*--Closing the session only if it is open.
IF V_FLAG1 = 'X'.
PERFORM FORM_CLOSESESS.
ENDIF.
ENDFORM. " Form_bdcgenerate
*& Form populatebdc
* FOrm to Populate the BDC table.
FORM POPULATEBDC USING VALUE(P_0178)
VALUE(P_0179)
VALUE(P_0180).
IF P_0178 = 'X'.
IT_CUSTBDC-PROGRAM = P_0179.
IT_CUSTBDC-DYNPRO = P_0180.
IT_CUSTBDC-DYNBEGIN = 'X'.
ELSE.
IT_CUSTBDC-FNAM = P_0179.
IT_CUSTBDC-FVAL = P_0180.
ENDIF.
APPEND IT_CUSTBDC.
CLEAR IT_CUSTBDC.
ENDFORM. " populatebdc
*& Form FORM_OPENSESSION
* Form to Open a session.
FORM FORM_OPENSESSION .
*--Variable to convert the given session name into reqd type.
DATA : LV_SESNAM(12).
LV_SESNAM = V_SESNAM.
*--Opening a session.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
CLIENT = SY-MANDT
GROUP = LV_SESNAM
HOLDDATE = '20040805'
KEEP = 'X'
USER = SY-UNAME
PROG = SY-CPROG
* IMPORTING
* QID =
EXCEPTIONS
CLIENT_INVALID = 1
DESTINATION_INVALID = 2
GROUP_INVALID = 3
GROUP_IS_LOCKED = 4
HOLDDATE_INVALID = 5
INTERNAL_ERROR = 6
QUEUE_ERROR = 7
RUNNING = 8
SYSTEM_LOCK_ERROR = 9
USER_INVALID = 10
OTHERS = 11
IF SY-SUBRC <> 0.
WRITE :/ 'Session not open'.
ENDIF.
ENDFORM. " FORM_OPENSESSION
*& Form FORM_INSERT
* fORM TO INSERT ERROR RECOED INTO A SESSION.
FORM FORM_INSERT .
*--Inserting the record into session.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
TCODE = 'FD01'
* POST_LOCAL = NOVBLOCAL
* PRINTING = NOPRINT
* SIMUBATCH = ' '
* CTUPARAMS = ' '
TABLES
DYNPROTAB = IT_CUSTBDC
EXCEPTIONS
INTERNAL_ERROR = 1
NOT_OPEN = 2
QUEUE_ERROR = 3
TCODE_INVALID = 4
PRINTING_INVALID = 5
POSTING_INVALID = 6
OTHERS = 7
IF SY-SUBRC <> 0.
WRITE :/ 'Unable to insert the record'.
ENDIF.
ENDFORM. " FORM_INSERT
*& Form FORM_CLOSESESS
* Form to Close the Open Session.
FORM FORM_CLOSESESS .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
NOT_OPEN = 1
QUEUE_ERROR = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
ENDIF.
ENDFORM. " FORM_CLOSESESS
*& Form FORM_FORMATMSG
* Form to format messages.
FORM FORM_FORMATMSG .
*--Var to store the formatted msg.
DATA : LV_MSG(255).
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = SY-MSGID
LANG = SY-LANGU
NO = SY-MSGNO
V1 = SY-MSGV1
V2 = SY-MSGV2
V3 = SY-MSGV3
V4 = SY-MSGV4
IMPORTING
MSG = LV_MSG
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC = 0.
WRITE :/ LV_MSG.
ENDIF.
ULINE.
ENDFORM. " FORM_FORMATMSG
*& Form form_writeop
* To write the totals and the session name.
FORM FORM_WRITEOP .
WRITE :/ 'Total Records Uploaded :',V_TLINES,
/ 'No of Error Records :',V_ELINES,
/ 'No of Success Records :',V_SLINES,
/ 'Name of the Session :',V_SESNAM.
ULINE.
ENDFORM. " form_writeop -
How to see SOP lines of my adpater code in my log files
Hi,
I am not able to see my SOP lines in the log files when my adapter executes. Its strange but its true. I changed the log.properties file to DEBUG for adapters.
Do I have to set any other configuration change?
Please suggest.
Thanks,
Kalpana.our OIM version is 9.1.0.18.
Also I have one question, if one jar file gets compiled in one jdk version(lower version) and then I make changes in that same java code and build the same jar file(with higher version of jdk), does it takes the changes into consideration while executing that jar file?
This jar file which i am testing was build by my colleague in jdk lower version, I made changes to the same java code and created jar file(with higher version of jdk).
When i run the code, then my sop lines, log.debug, log.error, log,info is not getting printed in the log file. Dont know where I am going wrong.
If anybody has any information, then please share. -
Cannot print pdf from Excel. Saving as log file
I am trying to print an Excel page to pdf and everytime I get an error.
I am using Adobe Acrobat 9 and Excel 2010You printed to Adobe PDF from excel.
There was an error which prevented the pdf from being created.
That log file lists the errors and seeing it's content might enable us to determine why the job failed.
Open the log file with Notepad or any text editor (Word)
Copy that text to this forum -
Print a custom Error message in the XML bursting program's log file...
Hi,
I having this requirement, where i need to print a custom error message in the xml bursting program's log file.
Actually i am having a report where i create invoices and then those invoices are emailed to the respective customers, now say if a customer has three contacts and there is only two valid email id's so what happens is bursting will be successful for two contacts whereas the third contact dosen't get any emails. when this happens i need to log a message in the bursting programs log file stating a custom message.
Two things i want to know..
1- Whether is it possible to write into the xml bursting programs log file
2- If yes, then how..
note: it ll be greatly appreciated if the answer is elaborated.
thanks,
RagulHi,
I having this requirement, where i need to print a custom error message in the xml bursting program's log file.
Actually i am having a report where i create invoices and then those invoices are emailed to the respective customers, now say if a customer has three contacts and there is only two valid email id's so what happens is bursting will be successful for two contacts whereas the third contact dosen't get any emails. when this happens i need to log a message in the bursting programs log file stating a custom message.
Two things i want to know..
1- Whether is it possible to write into the xml bursting programs log file
2- If yes, then how..
note: it ll be greatly appreciated if the answer is elaborated.
thanks,
Ragul
Maybe you are looking for
-
Active Directory Server Problem
Hi All, This mail Seeks to get help from people who have worked with Active Directory Server. The following is our Current scenario. We are in the process of establishing an SSL connection to Active Directory Server from java environment(a standalone
-
Std report transactions in SAP MM
Can somebody provide me all Std SAP MM transactions for SAP MM. Urgent pl. Thanks
-
T61 Windows Vista Ultimate and MS Office 2007
I have installed the above and MS Office is closing often with error message suggesting to use diagnosis. How to fix this problem.
-
Hi, I have an iPod Shuffle 1st Generation 512Mb. I am planning to gift it to my grandma for her birthday but unfortunately, the I have lost the USB cap that covers the built in USB port on it. I have not had any luck finding it, and I was wondering i
-
How can CRM trigger event of R/3
Hello Folks, My requireemnt I need to run a workflow in R/3 which will be triggered by CRM. Can you give me a breif how we link CRM with R/3. Is it only with RFC. Or can we dirctly trigger a event of R/3 from CRM. Please let me know the details