logfile

python telnet and put the message in a particular log file

[亡魂溺海] 提交于 2019-12-08 07:36:27
hi I am coding the python script to login telnet and it has to write log file to op.txt the absolute path is /netperf/mntpt/array1/home/prg_use/op.txt the python code ptlog.py import getpass import sys import telnetlib import time host ="12.12.1.123" user ="user_name" passwd ="telnet_password" tn = telnetlib.Telnet(host) tn.read_until("login: ") tn.write(user + "\n") tn.read_until("Password: ") tn.write(passwd + "\n") tn.write("touch op.txt \n") time.sleep(5) tn.write("lr \n") str_all=tn.read_until("$") #f=open("/netperf/mntpt/array1/home/prg_use/op.txt", "w") f=open("op.txt", "w") f.write(str

How to capture post method request in access log file?

依然范特西╮ 提交于 2019-12-07 23:39:25
I am enabling the access log in jboss Server by uncommenting the below code in server.xml file <Valve className="org.apache.catalina.valves.AccessLogValve" prefix="localhost_access_log." suffix=".log" pattern="common" directory="${jboss.server.home.dir}/log" resolveHosts="false" /> Access logs are creating on the daily basis. I am able to see get method request in access log file but not able to see post method request. How can I capture the details of post method request in server access log file in jboss. Thanks in advance ! You are using pattern as common which is equivalents to '%h %l %u

Node.js monitor file for changes and parse them

六月ゝ 毕业季﹏ 提交于 2019-12-06 16:16:47
问题 I need to monitor a file for changes. Due to a large amount of new entries to this file I would need to 'monitor' this file. I would need to get the new inserted content to this file to be able to parse this content. I found this code: fs.watchFile('var/log/query.log', function() { console.log('File Changed ...'); //how to get the new line which is now inserted? }); 回答1: On bash you would do something like that with tail --follow . There is also a package tail availible. you can watch on a

Lifeupdate DataGrid from TextFile with good performance

蹲街弑〆低调 提交于 2019-12-04 06:35:50
问题 Actual state: I have a DataGrid with 4 Columns (Icon|DateTime|LogLevel|Message) I use it as a viewer to present entries of a LogFile . When opening the Window the UI lags and alot of entries are added one by one to the DataGrid . Note: I am already using multiple threads. My UI-Thread is not freezing. Its just taking way to long to fill the whole DataGrid . What I want: I would prefer something like "pre-render" the whole window before showing it to the user. When I have aready opened the

Node.js console.log() in txt file

核能气质少年 提交于 2019-12-03 19:05:23
问题 I have another question (last question). At the moment i am working on a Node.js project and in this I have many console.log() functions. This has worked okay so far but I also want everything that's written to the console to also be written in a log-file. Can someone please help me? For example: Console.log('The value of array position [5] is '+ array[5]); In my real code its a bit more but this should give you an idea. Thank you hopefully. 回答1: I would use a library instead of re-inventing

Forever log and logrotate

被刻印的时光 ゝ 提交于 2019-12-03 11:47:06
问题 I use forever to launch my nodeJs server and I choose the log file : forever -l /home/api/log/api_output.log start server.js I use logrotate to move logfile every day (like advise here : NodeJS/Forever archive logs), after one day my directory is like this : -rw-r--r-- 1 root root 0 avril 18 12:00 api_output.log -rw-r--r-- 1 root root 95492 avril 18 12:01 api_output.log-20140418 So, rotation is working, but the logs messages are now written in api_output.log-20140418, instead of api_output

Forever log and logrotate

醉酒当歌 提交于 2019-12-03 03:10:30
I use forever to launch my nodeJs server and I choose the log file : forever -l /home/api/log/api_output.log start server.js I use logrotate to move logfile every day (like advise here : NodeJS/Forever archive logs ), after one day my directory is like this : -rw-r--r-- 1 root root 0 avril 18 12:00 api_output.log -rw-r--r-- 1 root root 95492 avril 18 12:01 api_output.log-20140418 So, rotation is working, but the logs messages are now written in api_output.log-20140418, instead of api_output.log Maybe somebody can help me ? I forgot copytruncate option in my config file, now it's working : /etc

How to append hostname to log file in log4j.xml

老子叫甜甜 提交于 2019-11-30 07:08:34
I want to append hostname and date to log file name.So log file Name should be like app_hostname.date.log . Note: This should run in both linux and windows. <appender name="applog" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="${path}/app.log" /> <param name="MaxFileSize" value="1MB" /> <param name="DatePattern" value=".dd-MM-yyyy" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d{dd-MM-yyyy HH:mm:ss}] [%-5p] %m%n"/> </layout> </appender> And how to add filter based on the log pattern, not as StringMatchFilter .I want

How to append hostname to log file in log4j.xml

核能气质少年 提交于 2019-11-29 09:48:48
问题 I want to append hostname and date to log file name.So log file Name should be like app_hostname.date.log . Note: This should run in both linux and windows. <appender name="applog" class="org.apache.log4j.DailyRollingFileAppender"> <param name="File" value="${path}/app.log" /> <param name="MaxFileSize" value="1MB" /> <param name="DatePattern" value=".dd-MM-yyyy" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[%d{dd-MM-yyyy HH:mm:ss}] [%-5p] %m%n"/> <

How can I follow a file like “Tail -f” does in Java without holding the file open (Prevent rename/delete)

时光总嘲笑我的痴心妄想 提交于 2019-11-28 19:17:01
问题 i'd like to "Tail -f" a lot of logfiles from within a java app. I've gotten this to work by monitoring the size and last update and repeatedly opening the file and reading the last few bytes whenever the file size or last update time changes--then closing it right away. This seems problematic because I might have it open when the logger decides to rename the file which will cause some kind of problem. I'd also like to detect a "Rolled" file with a mechanism more sure than noticing that the