I want to show my logs in the GUI in a textfield, list, etc. (something like ImgBurn), but I not found a ready appender that do this. There are an appender to do this?
Currently I doing log to the console without any problems.
Take a look at Apache Chainsaw: this can use the Receiver concept from the recent Log4j builds to display events: http://logging.apache.org/chainsaw/index.html.
If you are looking to do real-time text field display you may need to write your own Receiver class.
There are some good tools available for Free (paid as well) that can parse your log files and present them in better formats with lots of filtering and reporting options as well.
Here is a good list of such tools
Are you looking for a real time log viewer?
I can recommend you OtrosLogViewr. It can tail logs from running applications even on remote servers (using SFTP, FTP, Samba)
Check out the latest developer snapshot of Chainsaw - tons of new features, and when configured to process log files via VFSLogFilePatternReceiver, can tail log files, even between app restarts.
There are a ton of new features in this version compared with the currently-released one - some of the more helpful include search results that are highlighted and aggregated in a table, and the ability to annotate events (click in the 'marker' field)
http://people.apache.org/~sdeboy
Try Glasswall, which appends the log contents on the page if you are running a servlet.
http://code.google.com/p/glasswall/
Related
I have an assignment in Javafx to take a basic login application and have it produce an audit log that includes the entries the user put in the text boxes and the buttons pressed along with the date and time. I have searched high and low and I cannot find an example that I can make work with my application. Can someone provide me a basic example of how to implement the audit log or point me in the right direction?
For a professional application, many people use java.util.logging, or Apache Log4J. However, since this is an assignment, I assume your instructor wishes you to keep a log using your own File I/O.
I would suggest implementing a method called log(String message) which opens your audit file and appends a line to the end with the current timestamp and given message. Then, everywhere in your application you need to log something, you simply call your own log(message) function.
For more help with File IO, try reading through this tutorial, or searching google for a good one.
I am working on implementing SonarQube plugin for a custom platform specific language. The documentation is very limited and any code examples I see are outdated - usage of Decorators instead of MeasureComputer etc. I went through the sample plugin but it does not have the context I am looking for. My question is - how do I exchange the data between the Sensor and MeasureComputer implementation. The plugin invokes a command-line (vendor specific and I cannot change) that writes the data to a file. I would like the data from this file displayed in the General Metrics screen. In Sensor execute method, I am able to parse the file but I cannot save the Measure as the API has changed now and requires me to save the Measure with .on method that requires an InputFile, but this data is on the entire project and not on a file. I am not able to do a simple save of Metric on the project. I tried using MeasureComputer implementation, but I understand that this runs in Background task on server side, so I thought of setting the property under context.settings.setString("propName", "value") and tried retriving it using (MeasureComputerContext) context.getSettings().getString("propName"). This is not working either.
Can I save a Metric on the context that can be displayed in General inside a Sensor on the project and not the resource in 5.6.6 version. If so how?
If above is not possible, how can I store the file content to exchange with MeasureComputer, either add to list of files or set the property or object to be retrieved in MeasureComputer.
Thanks in Advance for your help. I have spent considerable time on this and the documentation leaves a lot to figure out.
For anyone else ending up here, looking for an answer, see the answer posted by Julien Henry on Google Groups here - https://groups.google.com/d/msg/sonarqube/yWsp7vuIsSo/ZugXMkp8CwAJ. Essentially, you can set the property at module level using .on(context.module()) and use it in Compute Engine.
I have my application log file stored in the project directory. For better UI experience I want to put a button in my java application which says "Export Log files". I want to read from an existing file on a disk and allow it to be saved by user anywhere he wants so he won't have to go searching for the log files.
How is it possible to do it? I tried to Google but the result of these keyword searches doesn't show the links I would be interested in.
Start by taking a look at Basic I/O. This will provide you with the basic concept of dealing with input/output streams and readers and writers.
You can also have a look at File I/O (Featuring NIO.2) which provides actually examples of copying files and directories...
Now, personally, I prefer to manually copy files using Input/OutputStreams or Reader/Writers. The reasons for this is I can provide progress indication of the copy process, which the NIO.2 API's don't provide...
For example, see JTextArea appending problems
I have an issues with the file Error.log which is generate by Java.
It's too big (Currently >10Go) I can't open it with Notepad++/SublimeText etc.. and as it's on a dedicated computer, transfering it with Teamviewers make Teamviewer crash.
I would like to know if there is a way to configure how the error.log file is generated.
I want to have one file each days and only keep the last 7 days.
Can I configure Java to do that ? Or do I need to redirect System.err to a file ?
Thanks.
There are some java libraries you can use to manage log files the most popular log4j. So if you can edit the source code, this library can help achieve what you want. Besides that there are some tools that can handle large log files and give you search functionnality, edit reports and so on. try look for splunk, elasticsearch, kibana ..
If you have source code available just change log4j configuration. If not then try following
create a job which checks consistently to the log file and rename this when size exceeds some configurable value.
I currently have a web application and wish to add certain statistics to the site. These statistics would be in addition to web statistics.
I can easily log certain events to a file via log4j. Is there something I can add that will investigate the data and format it in a human readable way (chart or table)?
The application is running in tomcat.
We log events for our web-shop in our database. Something like this
ID-----USER-----EVENTTYPE-----DATE
Then it's easy to create graphs with Google Chart showing logins, orders created, payments done with visa vs mastercard, files download last 30 days etc..
You might want to try JMX and a console that will let you see values at runtime.
You could create an MBean and view it through jmx console. Or add a class that handles the logging, and format it, and then in Log4J you could output that class only to it's own log file. You could then write a parser on that file, and view it via a webpage if necessary.