Array to log file
Necesito llevar un arreglo bidimensional a un fichero log, de dos columnas, en una el tiempo y en la otra todos los valores del arreglo, el fichero log se debe ir llenando con el tiempo, segun se vayan capturando las señales que conforman el arreglo, espero por su ayuda.
Translation, c/o Google Translate:
I need to take a two dimensional array to a log file, two columns, in a time and all the other values in the array, the log file should be filled up with time, as they are capturing the signals that make up the array, I hope for your help.
Write to Spreadsheet File, Write to Measurement File, Write Text File, TDMS File I/O, ...
Similar Messages
-
Help with Script created to check log files.
Hi,
I have a program we use in our organization on multiple workstations that connect to a MS SQL 2005 database on a Virtual Microsoft 2008 r2 Server. The program is quite old and programmed around the days when serial connections were the most efficient means
of connection to a device. If for any reason the network, virtual server or the SAN which the virtual server runs off have roughly 25% utilization or higher on its resources the program on the workstations timeout from the SQL database and drop the program
from the database completely rendering it useless. The program does not have the smarts to resync itself to the SQL database and it just sits there with "connection failed" until human interaction. A simple restart of the program reconnects itself
to the SQL database without any issues. This is fine when staff are onsite but the program runs on systems out of hours when the site is unmanned.
The utilization of the server environment is more than sufficient if not it has double the recommended resources needed for the program. I am in regular contact with the support for the program and it is a known issue for them which i believe they do not
have any desire to fix in the near future.
I wish to create a simple script that checks the log files on each workstation or server the program runs on and emails me if a specific word comes up in that log file. The word will only show when a connection failure has occurred.
After the email is sent i wish for the script to close the program and reopen it to resync the connection.
I will schedule the script to run ever 15 minutes.
I have posted this up in a previous post about a month ago but i went on holidays over xmas and the post died from my lack or response.
Below is what i have so far as my script. I have only completed the monitoring of the log file and the email portion of it. I had some help from a guy on this forum to get the script to where it is now. I know basic to intermediate scripting so sorry for my
crudity if any.
The program is called "wasteman2G" and the log file is located in \\servername\WasteMan2G\Config\DCS\DCS_IN\alert.txt
I would like to get the email side of this script working first and then move on to getting the restart of the program running after.
At the moment i am not receiving an error from the script. It runs and doesn't complete what it should.
Could someone please help?
Const strMailto = "[email protected]"
Const strMailFrom = "[email protected]"
Const strSMTPServer = "mrc1tpv002.XXXX.local"
Const FileToRead = "\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\alert.txt"
arrTextToScanFor = Array("SVR2006","SVR2008")
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
Set oFile = objFSO.GetFile(FileToRead)
dLastCreateDate = CDate(WshShell.RegRead("HKLM\Software\RDScripts\CheckTXTFile\CreateDate"))
If oFile.DateCreated = dLastCreateDate Then
intStartAtLine = CInt(WshShell.RegRead("HKLM\Software\RDScripts\CheckTXTFile\LastLineChecked"))
Else
intStartAtLine = 0
End If
i = 0
Set objTextFile = oFile.OpenAsTextStream()
Do While Not objTextFile.AtEndOfStream
If i < intStartAtLine Then
objTextFile.SkipLine
Else
strNextLine = objTextFile.Readline()
For each strItem in arrTextToScanFor
If InStr(LCase(strNextLine),LCase(strItem)) Then
strResults = strNextLine & vbcrlf & strResults
End If
Next
End If
i = i + 1
Loop
objTextFile.close
WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\FileChecked", FileToRead, "REG_SZ"
WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\CreateDate", oFile.DateCreated, "REG_SZ"
WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\LastLineChecked", i, "REG_DWORD"
WshShell.RegWrite "HKLM\Software\RDScripts\CheckTXTFile\LastScanned", Now, "REG_SZ"
If strResults <> "" Then
SendCDOMail strMailFrom,strMailto,"VPN Logfile scan alert",strResults,"","",strSMTPServer
End If
Function SendCDOMail( strFrom, strSendTo, strSubject, strMessage , strUser, strPassword, strSMTP )
With CreateObject("CDO.Message")
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = strSMTP
.Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic
.Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/sendusername") = strUser
.Configuration.Fields.item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = strPassword
.Configuration.Fields.Update
.From = strFrom
.To = strSendTo
.Subject = strSubject
.TextBody = strMessage
On Error Resume Next
.Send
If Err.Number <> 0 Then
WScript.Echo "SendMail Failed:" & Err.Description
End If
End With
End FunctionThankyou for that link, it did help quite a bit. What i wanted was to move it to csript so i could run the wscript.echo in commandline. It all took to long and found a way to complete it via Batch. I do have a problem with my script though and you might
be able to help.
What i am doing is searching the log file. Finding the specific words then outputting them to an email. I havent used bmail before so thats probably my problem but then im using bmail to send me the results.
Then im clearing the log file so the next day it is empty so that when i search it every 15 minutes its clean and only when an error occurs it will email me.
Could you help me send the output via email using bmail or blat?
@echo off
echo Wasteman Logfile checker
echo Created by: Reece Vellios
echo Date: 08/01/2014
findstr "SRV2006 & SRV2008" \\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt > c:\log4mail.txt
if %errorlevel%==0 C:\Documents and Settings\rvellios\Desktop\DCS Checker\bmail.exe -s mrc1tpv002.xxx.local -t [email protected] -f [email protected] -h -a "Process Dump" -m c:\log4mail.txt -c
for %%G in (\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt) do (copy /Y nul "%%G")
This the working script without bmail
@echo off
echo Wasteman Logfile checker
echo Created by: Reece Vellios
echo Date: 08/01/2014
findstr "SRV2006 & SRV2008" \\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt > C:\log4mail.txt
if %errorlevel%==0 (echo Connection error)
for %%G in (\\Mrctpv005\WasteMan2G\Config\DCS\DCS_IN\Alert.Txt) do (copy /Y nul "%%G")
I need to make this happen:
If error occurs at "%errorlevel%=0" then it will output the c:\log4mail.txt via smtp email using bmail. -
Application to read 2 log files from internet
Hi,
Anybody could tell me how to develop this project. I'm lack of time. thanks
You have been asked into a company called Broken Arrow Software as a Senior Software Engineer and Management consultant. You are being paid very handsomely and have been asked to write an application program in Java for parsing a log file.
� The program will have a standard menu using the AWT only.
� ALL LAYOUTS MUST USE ONLY THE BORDER-LAYOUT OR GRID-LAYOUT OR A COMBINATION OF BOTH (Any other layouts score zero).
This application reads two Log files from the internet. The first file contains USA state names and the abbreviation used for that state. This information will be used in displaying totals from another network file and should be stored in an array (or two arrays, or a two dimensional array) in the program. The second file should extract the �Reversed subdomain� section from a Log file (a section is shown later) and store this in an array in the application. This should be processed and only those domains beginning with �us.� should be processed. Each �us.� Has an abbreviated USA state after it (�tx� is an abbreviation for Texas). The abbreviations are sorted and all states are on consecutive lines and each displays a number of accesses for that state. The accesses should be totalled and displayed in the current Frame for each state in the form of Java List components (these do not need to be synchronised so that they all scroll in unison).
The application will be a Java application with the following menus and MenuItems:
� Splash screen (10%)
� Application (20%)
o Open USA abbreviation file
o Clear screen
o Exit
� File (25%)
o Open network log file
o Open locally saved report file
o Recent report files
o Save as report file
� Graph (20%)
o Plot
� Help (15%)
o Help on Application
o About
A basic pass for the application will be for a basic implementation of an application with �help� options and some basic implementations of a Splash screen and some basic file and application options. Very high marks will be awarded for processing network files, saving and opening files, very good HCI, application design and error handling, excellent OO design for classes, gorgeous layout and commenting of code and excellent graphing capabilities.
Error handling dialogs and overall application design (10%)
Every class must be in a separate file.
Inheritance should be used for WindowListeners of Frames and Dialogs.
Up to 10% can also be lost by unprofessional code layout and lack of professional standards. Always adhere to standards taught throughout the module and your time at the University of Northumbria.
Examples of non-professionalism would include bad indentation, no comments, meaningless variable names, politically incorrect graphics, commented out code, empty .java files, .java files which are not part of the project etc. Remember your application is your livelihood and your company depends on your application standards.
The splash screen must be a Frame with a Canvas as part of it showing your own logo. Your logo should be individual to you but does not need to win the computing equivalent of the Turner prize. The application should be displayed behind the Splash screen and both should be visible. The application must not be able to be brought to the front and used without the Splash screen being disposed of.
The application should only enable the �Open USA abbreviation file�, �Open locally saved report file�, �Help� options and �Exit� Menus and MenuItems, when the application starts. On opening a valid USA abbreviation file, then the other Menus and MenuItems should be enabled.
The abbreviations should be read into an array. These should be used in displaying the totals for the reversed subdomain totals for each USA state. A total for all USA states should be displayed at the bottom of the current Frame, with a suitable Label (this design is your own). This current Frame should display a series of Lists starting with a List of USA state number (1 to n). A List of USA state abbreviation should be next followed by a List of the actual USA state name, followed by a List of the total accesses for that state.
The report file should be an ASCII file that can be printed out from an ASCII text editor such as DOS edit or Microsoft NotePad.
The �Open� network files should display a Dialog asking for the http:// address of the file, with �OK� and �Cancel� options. It is helpful if the user can hit �return� instead of clicking on �OK� and �Escape� instead of �cancel�. Error Dialogs should be used to indicate any errors that may occur and the state of the application should be reset to that of before displaying the Dialog.
When �Save as report file� is chosen a FileDialog box should be used for the user to choose both directory and filename. The file should be able to be saved as a �.rpt� file.
Open report file should display the report in a Frame; the design of which is your own.
Plotting the graph should pass a two dimensional array to a Frame with a Canvas. The Canvas should have a Paint method that draws the axis for the graph and any suitable Headings etc. The graph should draw a histogram of totals per USA states. The graph design is your own but you may wish to use Microsoft Excel as a good example of drawing a histogram.
The �Clear screen� option should clear any data off the current screen.
The �Exit� option should quit the application but it may be helpful to ask the user if they really want to exit the application.
Help must be Java code and not linking into HTML. It should display help in a well designed screen. The most basic implementation might use a scrollable TextArea for a basic mark.
See other software for a good �About� screen. The most basic should display your name, date, version and company.
� Help should display your help on using the application. As a senior software engineer, the design is your own, based on experience of using applications, as is the opening splash screen. You may use other applications for inspiration only, as these will make up your experience.
� Your good knowledge gained from HCI units studied should prove invaluable in the interface design and the usability of the application.
� The design (Screens and classes) and quality and documentation of code throughout the application will be marked. The experience gained from programming 1 and 2 and Object Oriented Programming should prove invaluable throughout the application, as should any GUI units studied.
The log file can be accessed at:
http://computing.unn.ac.uk/staff/cgpb2/public_html/log.htmlYou would really gain ever so much more from this exercise if you would write a couple of classes, then come back with some specific questions. If you're completely lost, try starting with the GUI first. It's not the best practice, always, but it is easy to visualize.
On a side note, I wish I'd had assignments even half this intersting when I was in my Java classes... -
Hi,
I have created a script (see below) which alert unused character and paragraph style in active document.
My Script
myUnusedParagraphStyleName();
myUnusedCharacterStyleName();
function myUnusedParagraphStyleName()
var myDoc = app.activeDocument;
var myParStyles = myDoc.allParagraphStyles;
var foundPStyles = [];
for (i = myParStyles.length-1; i >= 2; i-- ){
foundPStyles.push(myParStyles.[i].name);
alert(foundPStyles.join("\r "));
function myUnusedCharacterStyleName()
var myDoc = app.activeDocument;
var myCharStyles = myDoc.allCharacterStyles;
var foundCStyles = [];
for (i = myCharStyles.length-1; i >= 1; i-- ){
foundCStyles.push(myCharStyles.[i].name);
alert(foundCStyles.join("\r "));
But I want to save my alert message as a log file on my Desktop. I have search and found an example (see below) but I couldn't merge this code with my script.
Can anybody please merge this code within my JS. So that my script save a log file in desktop. I really appreciate all your support.
Example taken from Adobe Forum
var myDoc = app.activeDocument;
var myDocPath = myDoc.filePath;
var myDocName = myDoc.name;
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.findWhat = "\\b(\\w.+\\s000\\s000\\s00)";
var mySearch = myDoc.findGrep();
var myFound = new Array()
for (var j = 0; j < mySearch.length; j++)
myFound.push (mySearch[j].contents);
alert(myFound);
var inc=0;
var myLogFile = new File(myDocPath.fsName + "/Report_" + myDocName.split(".")[0] +".txt");
if(myLogFile.open("w", undefined, undefined))
myLogFile.writeln("Tool name : Report Generator for CS5");
myLogFile.writeln("************************************");
if(myFound.length != 0)
myLogFile.writeln("");
for (var k = 0; k<myFound.length; k++)
serialno = k + 1;
myLogFile.writeln(" "+serialno+". "+myFound[k]);
myLogFile.execute();
else
myLogFile.writeln("No terms found");
Thanks in advance.
MonHere is it.
var foundPStyles = [];var foundCStyles = [];var myDoc = app.activeDocument;var myDocPath = myDoc.filePath;var myDocName = myDoc.name; myUnusedParagraphStyleName();myUnusedCharacterStyleName();myWrite2Log(); function myUnusedParagraphStyleName(){ var myParStyles = myDoc.allParagraphStyles; for (i = myParStyles.length-1; i >= 2; i-- ) { foundPStyles.push(myParStyles[i].name); } // alert(foundPStyles.join("\r "));}function myUnusedCharacterStyleName(){ var myCharStyles = myDoc.allCharacterStyles; for (i = myCharStyles.length-1; i >= 1; i-- ){ foundCStyles.push(myCharStyles[i].name); } // alert(foundCStyles.join("\r "));}function myWrite2Log(){ var inc=0; var myLogFile = new File(Folder.desktop+"/Report.txt"); if(myLogFile.open("w", undefined, undefined)) { myLogFile.writeln("Unused ParaGraph Styles\n=======================\n\r"); if(foundPStyles.length != 0) { myLogFile.writeln(""); for (var k = 0; k<foundPStyles.length; k++) { serialno = k + 1; myLogFile.writeln("\t"+serialno+".\t"+foundPStyles[k]); } } else { myLogFile.writeln("\nNo Unused ParaGraph Styles Found\n\n"); } myLogFile.writeln("\n\nUnused Character Styles\n=======================\n\r"); if(foundCStyles.length != 0) { myLogFile.writeln(""); for (var k = 0; k<foundCStyles.length; k++) { serialno = k + 1; myLogFile.writeln("\t"+serialno+".\t"+foundCStyles[k]); } } else { myLogFile.writeln("\nNo Unused Character Styles Found"); } } myLogFile.close();}
Hope this Helps to you -
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 -
I know OS X Server uses PostgreSQL now instead of MySQL which is fine by me. I am trying to figure out what is in the PostgreSQL_Server_Services.log file in Library/Logs/PostgreSQL/ . It is about 188 GB right now and ideally instead of relocating it along with other services to another drive from the nice 256GB SSD that is in the system I would like to understand what is in the database and how to manage it's size better.
Any pointers for best practice on managing the database or what the heck is in it?
Thanks!Thanks for the response. I mistyped in the question as I understood it was a log file. The DB itself is only about 1-2GB. As for reviewing I am fine with modifying the permissions and examining the file in the console or other app but I am most interested in how to manage it safely. Can I just clear the log contents? If so what is the safe way to do so? I know with many DB's the log file is critical to it's function and if things happen to the log file it can render the DB unusable. In addition what is the best way to modify the rotation routine it uses and set the logging level? (I have pasted the .plist contents for Postgresql for Server Services below)
I have also downloaded and installed pgAdmin but have not gone through the steps of connecting it to the DB and log file (users setup etc.)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ProgramArguments</key>
<array>
<string>-D</string>
<string>/Library/Server/PostgreSQL For Server Services/Data</string>
<string>-c</string>
<string>unix_socket_directory=/Library/Server/PostgreSQL For Server Services/Socket</string>
<string>-c</string>
<string>logging_collector=on</string>
<string>-c</string>
<string>log_connections=on</string>
<string>-c</string>
<string>log_lock_waits=on</string>
<string>-c</string>
<string>log_statement=ddl</string>
<string>-c</string>
<string>log_line_prefix=%t </string>
<string>-c</string>
<string>listen_addresses=</string>
<string>-c</string>
<string>log_directory=/Library/Logs/PostgreSQL</string>
<string>-c</string>
<string>log_filename=PostgreSQL_Server_Services.log</string>
<string>-c</string>
<string>unix_socket_group=_postgres</string>
<string>-c</string>
<string>unix_socket_permissions=0770</string>
</array>
</dict>
</plist> -
Log file sync waits with null sql_ids
10.2.0.3
I am querying V$ACTIVE_SESSION_HISTORY to drill into log file sync waits.
select sql_id,sum(time_waited)
from v$active_session_history
where sample_time > sysdate - 1/24
group by sql_id
order by 2 desc
All of my top sessions for this have null sql_ids. I did some google searches and these are the answers that I found have null sql_ids. There are some other sessions where the sql_id is not null, but they are not anywhere near the top.
1. could be running pl/sql. yeah ok. but I would need to run 'dml' and issue a commit for this event to fire).
2. no sql is running. does this mean the insert finished and then I am waiting on the 'commit' part?
I want to track these sqls down so I can track them back to the application. I want to get the developers to limit their commit frequency and use batch (array based) DML. How do I track this down?
Also, is there anyway to figure out how often different users are committing? I want to track back to the worst offenders. Could be some parts of the application are commit periodically and others are not, but log file sync's could slow down everyone.You are either bored or suffer from Compulsive Tuning Disorder.
It can be a challenge to solve a problem that only exists between your ears
post results from SQL below
SELECT sql_id,
SUM(time_waited) / 1000000
FROM v$active_session_history
WHERE sample_time > SYSDATE - 1 / 24
AND time_waited > 0
GROUP BY sql_id
ORDER BY 2 DESC -
Data log file refnum - what is it?
Hello all,
i want know what is it data log file refnum and how to use it.
Thanks.A datalog file is a file that stores data as a sequence of records of a single, arbitrary data type that you specify when you create the file. Although all the records in a datalog file must be a single type, that type can be complex. For instance, you can specify that each record is a cluster that contains a string, a number, and an array.
You could use a datalog file refnum if, for instance, you were creating a subVI which will be accepting a datalog file as an input. You could use this refnum to write to the file and perform other actions on it.
J.R. Allen -
SMTP Error in concurrent program log file
Hi All,
Please help me on this asap.
I need to send an excel file as attachment in a mail through a concurrent request submission. But after run the program I am getting the following error in log file.
'Error in Send Mail: ORA-29279: SMTP permanent error: 501 5.5.4 Invalid Address' for any email id.
Please let me know how can I resolve this issue. Appreciate your help.
Thanks,
JPThanks for the reply.
My OS is windows, EBS is 11.5.10.2. It is a custom concurrent program. We have SMTP server and this the first time I am working on mail sending. I am using the same code existed in my production env which sends mail for different purpose. I did not identified where the issue casues.
IF fexists THEN
fnd_file.put_line (FND_FILE.LOG,'File Exist');
if file_length > 1 then
fnd_file.put_line (FND_FILE.LOG,'File Size: '||file_length);
fnd_file.put_line (FND_FILE.LOG,'Block Size: '||block_size);
l_mail_error:= SendMailJPkg.SENDMAIL(
SMTPServerName => 'mocrsmtp',
Sender => '[email protected]',
Recipient => [email protected],
CcRecipient => '',
BccRecipient => '',
Subject => 'testmail',
Body => 'Dear Super User, '
||chr(13)
||chr(13)
||'Testing mail sending'
||chr(13)
||chr(13)
||'Thank you for your cooperation.',
ErrorMessage => l_mail_error,
Attachments => SendMailJPkg.ATTACHMENTS_LIST(v_file_path, NULL));
ELSE
fnd_file.put_line (FND_FILE.LOG,'File Size Else: '||file_length);
fnd_file.put_line (FND_FILE.LOG,'Block Size Else: '||block_size);
ots_send_mail_pkg.send
( p_sender_email => '[email protected]',
p_from => '[email protected]',
p_to => ots_send_mail_pkg.array('[email protected]'),
-- p_cc => ots_send_mail_pkg.array('[email protected]'),
p_bcc => ots_send_mail_pkg.array(''),
p_subject => v_subject_error,
p_body => v_body_error||v_file_name||'PDF' );
END IF;
ELSE
fnd_file.put_line (FND_FILE.LOG,'File Does Not Exist 1');
ots_send_mail_pkg.send
( p_sender_email => '[email protected]',
p_from => '[email protected]',
p_to => ots_send_mail_pkg.array('[email protected]'),
-- p_cc => ots_send_mail_pkg.array('[email protected]'),
p_bcc => ots_send_mail_pkg.array(''),
p_subject => v_subject_error_c,
p_body => v_body_error_c||v_file_name||'PDF' );
END IF;
ELSIF v_file_type = 'EXCEL' then
v_file_path := 'e:\oracle\uatcomn\admin\out\UAT_a7erpdb\'||v_file_name||'EXCEL';
utl_file.fgetattr('e:\oracle\uatcomn\admin\out\UAT_a7erpdb',
v_file_name||'EXCEL',
fexists,
file_length,
block_size);
I changed the original mail id. Please look into this code and correct me...thank you so much
Regards
JP -
Large log file to add to JList
Hello,
I have a rather large log file (> 250 000 lines) which I would like to add to a JList -- I can read the file okay but, obviously, can't fine a container which will hold that many items. Can someone suggest how I might do this?
Thanks.NegativeSpace13579 wrote:
I can't add that many items to a Vector or Array to pass to the JList.You fail to describe the problem you run into. Why can't you add that many items? Do you get any error message?
Please read http://catb.org/~esr/faqs/smart-questions.html to learn how to ask questions the smart way. -
Parsing Log file with PowerShell
Hey Guys, I have the following line in a txt file (log file)
2012-08-14 18:00:00 [ERROR] . Exception SQL error 1 2012-08-14 18:10:00 [ERROR] . Exception SQL error 22012-08-15 18:00:00 [INFO] . Started
- Check the most recent entry(s) the last 24 hours
- if there's an error [ERROR] write-out a statement that says (Critical) with the date-time of the error
- If there's no erros write-out (Ok)
So far I learned to write this much and would like to learn more from you:
$file = "C:\Users\example\Documents\Log.txt" cat $file | Select-String "ERROR" -SimpleMatchHello,
I am new to PowerShell, and looking for same requirement, here is my function.
Function CheckLogs()
param ([string] $logfile)
if(!$logfile) {write-host "Usage: ""<Log file path>"""; exit}
cat $logfile | Select-String "ERROR" -SimpleMatch | select -expand line |
foreach {
$_ -match '(.+)\s\[(ERROR)\]\s(.+)'| Out-Null
new-object psobject -Property @{Timestamp = [datetime]$matches[1];Error = $matches[2]} |
where {$_.timestamp -gt (get-date).AddDays(-1)}
$error_time = [datetime]($matches[1])
if ($error_time -gt (Get-Date).AddDays(-1) )
write-output "CRITICAL: There is an error in the log file $logfile around
$($error_time.ToShortTimeString())"; exit(2)
write-output "OK: There was no errors in the past 24 hours."
CheckLogs "C:\Log.txt" #Function Call
Content of my log file is as follows
[ERROR] 2013-12-23 19:46:32
[ERROR] 2013-12-24 19:46:35
[ERROR] 2013-12-24 19:48:56
[ERROR] 2013-12-24 20:13:07
After executing above script, getting the below error, can you please correct me.
$error_time = [datetime]($matches[1])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\PS\LogTest.ps1:10 char:21
+ new-object psobject -Property @{Timestamp =
[datetime]$match ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
Cannot index into a null array.
At C:\Test\LogTest.ps1:12 char:21
+ $error_time = [datetime]($matches[1])
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray -
Hello friends,
I am developing a program which works with 4 different text files.
3 of them for reading and 1 for writing and reading.
Here's a skeleton:
open file1 for reading.
for each element in file1 do
record the element in the log file
open file2 for reading
open file3 for writing
for every element in file2 do
process all elements in file2 for one element of file1
generating an element for file3
write out the processed elements to file3.
end for // here we have file3 ready for the next step
end for
open file3 for reading
open file4 for reading
for each element in file3 do
process result1 and store it in log file
process result2 and store it in log file
for each element in file4 do
process result3 and store it in log file
end for
end forCan anyone suggest me how to use the Logger to log all the results?
Also, How should I open the files to read and write?
I am new to working with files in java and reading about the different I/O streams is driving me nuts at the moment.
Thank you in advance.Thanks Keith for the useful links.
I had to do a bit of reading regarding working with files in java
here is what I have gotten to so far:
try {
// OPEN PERMUTATION FILE FOR READING
FileInputStream pstream = new FileInputStream("permutations.txt"); // THIS FILE IS GENERATED IN PREVIOUS STEP
DataInputStream pin = new DataInputStream(pstream);
BufferedReader pbr = new BufferedReader(new InputStreamReader(pin));
//FileReader permfr = new FileReader("permutations.txt");
//BufferedReader permbr = new BufferedReader(permfr); // WILL THIS WORK INSTEAD OF ABOVE 3 LINES?
//StreamTokenizer permst = new StreamTokenizer(permbr);
// OPEN INPUT FILE FOR READING
FileInputStream istream = new FileInputStream("sample.txt"); // THIS IS THE INPUT FILE OF WORDS
DataInputStream in = new DataInputStream(istream);
BufferedReader ibr = new BufferedReader(new InputStreamReader(in));
//FileReader ifr = new FileReader("sample.txt");
//BufferedReader ibr = new BufferedReader(ifr); // WILL THIS WORK INSTEAD OF ABOVE 3 LINES?
//StreamTokenizer ist = new StreamTokenizer(ibr);
// CREATE A TEMP FILE FOR OUTPUT
// Creating a temp file because I will be using it for one permutation only
// instead of writing to a file and clearing it again for the next permutation.
File tempoutput = File.createTempFile("output",".txt");
String permstr; // PERMUTATION string
String ipstr; // INPUT string
String opstr; // OUTPUT string
// create input char array, perm array and output char array
char[] permArray;
char[] opArray = null;
char[] ipArray;
while ((permstr = pbr.readLine()) != null) { // for all strings in permutation file do
// read one permutation string
StringTokenizer permst = new StringTokenizer(permstr);
while(permst.hasMoreTokens()){ // TILL the end of permutation file
// convert the permutation string to char array and store it
String perm = permst.nextToken();
permArray = perm.toCharArray();
// open the output file for writing
BufferedWriter out = new BufferedWriter(new FileWriter(tempoutput, true));
// open the input file (original dictionary) for reading
while ((ipstr = ibr.readLine()) != null) { // for all the words in the input file (dictionary)
// read one input string
StringTokenizer ipst = new StringTokenizer(ipstr);
while (ipst.hasMoreTokens()){
// convert it into a char array and store it in 'input' char array
String ip = ipst.nextToken();
ipArray = ip.toCharArray();
// for each element in the permute array
for(int i=0; i<=perm.length()-1; i++) {
// read the permute array elements, index i
// store it in input index j
int j = permArray;
// generate output as you go as output[i] = input[j]
opArray[i] = ipArray[j];
// convert output char array to string
opstr = String.valueOf(opArray);
// write the permuted output string to the output file
out.write("\n"+opstr);
out.flush();
out.close();
// OPEN OUTPUT FILE FOR READING
// RUN SOME PROGRAMS AND GENERATE SOME NUMBERS
newop.close();
STORE THE RESULTS (PREFERABLY IN A LOG FILE)
I AM STILL WORKING ON HOW TO DO THIS
tempoutput.delete(); // delete the temp input file
} // end reading permutation file
// CLOSE ALL STREAMS Below
pstream.close();
pin.close();
pbr.close();
istream.close();
in.close();
ibr.close();
catch (IOException e){
System.err.println("Error: " + e.getMessage());
I am currently debugging this piece of code.
Can anyone point out any flaws/design errors here?
Any suggestions to make it better/efficient?
Greatly appreciated as always. -
Important Configuration/Log Files for Storage Tek
Hi,
I have 6140 Storage Arrays, in the same ref. I would like to know more about command line details.
1. Important Configuration files
2. Important Log Files
3. Event Messages file
4. Important utilities like sscs, service, suppport and their default path.
5. Solaris FC constroller configuration files.
Please suggest in case I can get this details from any doc, as I already referred Sun Storage Tek 6140 Getting Started Guide for the same but not found much details.
Thanks
RajanI figured out what my problem was here. The Windows user that the portal processes run as is the user who writes the log files. In this case, this user is a local user to the portal server and not a Windows domain user. This means that the user does not have access to write to the shared drive.
We had two options as to what we could do here. The first would be to change the user that's running the portal to a user that could write to that shared drive. The second option would be to have the portal write the log files locally on the portal server and then have a script run as a domain user on that server sometime in the day and copy the files to the shared drive. We are going with the second option. -
Help on Reading and Reporting From A log File
Hi there
I need any assistance on developing a class that is able to read from a log file and then be filtered and put into a report. I need to be able to search on the log files per criteria.Chainsaw:
http://logging.apache.org/log4j/docs/chainsaw.html -
Steps to empty SAPDB (MaxDB) log file
Hello All,
i am on Redhat Unix Os with NW 7.1 CE and SAPDB as Back end. I am trying to login but my log file is full. Ii want to empty log file but i havn't done any data backup yet. Can anybody guide me how toproceed to handle this problem.
I do have some idea what to do like the steps below
1. take databackup (but i want to skip this step if possible) since this is a QA system and we are not a production company.
2. Take log backup using same methos as data backup but with Log type (am i right or there is somethign else)
3. It will automatically overwrite log after log backups.
or should i use this as an alternative, i found this in note Note 869267 - FAQ: SAP MaxDB LOG area
Can the log area be overwritten cyclically without having to make a log backup?
Yes, the log area can be automatically overwritten without log backups. Use the DBM command
util_execute SET LOG AUTO OVERWRITE ON
to set this status. The behavior of the database corresponds to the DEMO log mode in older versions. With version 7.4.03 and above, this behavior can be set online.
Log backups are not possible after switching on automatic overwrite. Backup history is broken down and flagged by the abbreviation HISTLOST in the backup history (dbm.knl file). The backup history is restarted when you switch off automatic overwrite without log backups using the command
util_execute SET LOG AUTO OVERWRITE OFF
and by creating a complete data backup in the ADMIN or ONLINE status.
Automatic overwrite of the log area without log backups is NOT suitable for production operation. Since no backup history exists for the following changes in the database, you cannot track transactions in the case of recovery.
any reply will be highly appreciated.
Thanks
ManiHello Mani,
1. Please review the document u201CUsing SAP MaxDB X Server Behind a Firewallu201D at MAXDB library
http://maxdb.sap.com/doc/7_7/44/bbddac91407006e10000000a155369/content.htm
u201CTo enable access to X Server (and thus the database) behind a firewall using a client program such as Database Studio, open the necessary ports in your firewall and restrict access to these ports to only those computers that need to access the database.u201D
Is the database server behind a Firewall? If yes, then the Xserver port need to be open. You could restrict access to this port to the computers of your database administrators, for example.
Is "nq2host" the name of the database server? Could you ping to the server "nq2host" from your machine?
2. And if the database server and your PC in the local area NetWork you could start the x_server on the database server & connect to the database using the DB studio on your PC, as you already told by Lars.
See the document u201CNetwork Communicationu201D at
http://maxdb.sap.com/doc/7_7/44/d7c3e72e6338d3e10000000a1553f7/content.htm
Thank you and best regards, Natalia Khlopina
Maybe you are looking for
-
Problem with FTE in DataTips of PlotChart (missing texts)
Hi @all, we have decided to use the Flex 4.1 and Flash text engine in our projects. Now I have the following problem with the dataTips: the texts are appearing only partly if datatips of more than one point are showing. The behavior is not regularly.
-
I have an iBook G4 12 inch screen mac. I have recently updated with the latest Apple security update (15/9/08)Since installing the update my iBook has failed to boot up successfully. There is no start-up chime and the boot stops at the grey screen wi
-
Hi, I want to know if trigger will be executed even if the transaction in which the table is participating is failed. e.g. if there are three tables participating in the particular transaction ,table update sequence is 1-->2-->3.The trigger is deploy
-
Download slow, download slow
My downloading is extremely slow. I have reset Safari and emptied the cache. Any other ideas?
-
HT1620 Where do you find security key for iOS on iPad. 4digit key for update..
Need to find security key. 4didgit To update iPad to7.1.1. I have no idea were it is , first time ever asked for a pass to update