Home › Forums › Administration › How to See a running service logs in Admin page?
Tagged: administration, service logs
- This topic has 3 replies, 3 voices, and was last updated 8 years, 9 months ago by Ed Shaw.
-
AuthorPosts
-
-
November 24, 2015 at 7:13 am #423ashutoshParticipant
Hi Team,
I have a made a service in NexJ. Which picks the files and process it? I want to see all the logs of the running service in the Admin page. Currently I am running the service in my local nexj studio and I see the logs in the eclipse console. What steps do I need to follow to see the running process logs in the admin page.
Please refer the screen shot.
Regards,
Ashutosh0Attachments:
You must be logged in to view attached files. -
November 24, 2015 at 1:02 pm #425Ed ShawKeymaster
Without code to support it, the only build in tracking of your service will be statistics indicating the number of messages sent or received over bound channels.
You have a few options to instument your code. First a few concepts:
1) the logger function allows you to output information to the logs
2) the SysProcess and related classes let you log activity to the Process tab of the Admin Console
3) statistics allow you to instrument your code and make it available in the Statistics Tab of the Admin Console and also via JMX
logger – See the logger help for information on this function. To read this, hover your mouse over “(logger” in a scratchpad. The logger will simply output the information you provide to log4j at the appropriate level. When running in NexJ Studio, you will see the output in the console. When running on a server the output will go to your server log files. Their location, name, rollover, etc. are controlled by log4j settings and will not be visible in the Admin Console.
SysProcess – To instrument your code to show status in the Process tab of the Admin Console, include something like this:
1234567891011121314151617181920212223242526272829303132333435363738(define myProcess ())(define items '("one" "two" "three"))(begin-transaction(set! myProcess(SysProcess'new(: name "My Process")(: category (ProcessCategoryEnum'get 'BATCH))))); any logger statements in the with-logger block; will be written to the system log as well as to; the process log in the Admin Console(with-logger myProcess(logger'info "Starting my process"); do some work(for-each(lambda (item)(logger'info "Processing item " item); put the pre-commit in here to ensure the order is; correct in the log since we are processing these; very quicky in a multi-threaded environment(pre-commit))items)(logger'info "Completed processing"))(myProcess'status (ProcessStatusEnum'get'COMPLETED))(commit)statistics – I don’t think this is what you are looking for so will go into statistics in a future article. Out of the box (in Jade) you can see channel statistics in the Statistics tab of the Admin console or attach to the JMX counters as described in https://community.nexj.com/featured-posts/2015/09/29/setting-up-remote-jmx-monitoring-with-mission-control-eclipse-plug-in/.
1- This reply was modified 8 years, 9 months ago by Andrew Penley.
- This reply was modified 8 years, 9 months ago by Andrew Penley.
- This reply was modified 8 years, 9 months ago by Andrew Penley.
-
November 24, 2015 at 1:08 pm #430ashutoshParticipant
Thank you very much Ed. I was looking exactly for this info you provided 🙂
Now I have to see how can I have the logger and SysProcess in my service implemented.
Regards,
Ashutosh0 -
November 24, 2015 at 1:24 pm #432Ed ShawKeymaster
So you will likely want to:
– create a variable on your service called something like process. This is done using the variables property on the service.
– add an initialization (script) step at the beginning and set the ‘process’ variable to a SysProcess instance. e.g.
123456(set! process(SysProcess'new(: name "My Process")(: category (ProcessCategoryEnum'get 'BATCH))))– whenever you are logging something in your code, wrap it in the (with-logger function. This means you shouldn’t use the Log step, you need to log using the (logger function in code.
– add a final step that will set the process status to COMPLETED as above.
0
-
-
AuthorPosts
- You must be logged in to reply to this topic.