Server Log Error Handler

Here we will consider the Log Error Handler, the powerful tool, which has been developed by the EasyQA team, to help you to detect and work with bugs.

Log Error Handler: what it is

Log Error Handler is a gem for revealing and processing bugs on your server.

Gem is a package management system for the Ruby programming language that provides a standard format for Ruby programs and libraries, tools designed to easily manage the "gems" installation, and the server for their distribution.

A .gem extension file is a common archive, inside of which there are a specification file and the source code of the library in the state at the release time.

The main advantages of the Log Error Handler:

You get installed and integrated Ruby on Rails library with all the necessary dependencies

It has no operational platform dependencies

You save your time with Log Error Handler

You have an ability to perform permanent monitoring of your servers activities

A notification message is sent automatically after the bug detection

Currently, there are 3 variants of actions for bug revealing such as:

To type in terminal

To write down in a separate document

To send HTTP request to the website.

Installation of the LogErrorHandler

You can install Log Error Handler in the two ways:

1. Add this line to your application's Gemfile:

copy gem ' log_error_handler '

And then execute:

copy $ bundle

2. Install it yourself as:

copy $ gem install log_error_handler

Log Error Handler Using

To make gem work, there should be a constant output data flow. Here are also two ways to do it.

1. To lead pipe to gem, e.g:

copy $ rails s | log_error_handler

This will ensure stdout of your program to stdin of the gem. The minus of such an approach is that you can apply it only while launching your program which logs you want to track.

2. To show the way to your log file to program,e.g:

copy $ log_error_handler -l log/development.log

To output logs in a correct way, gem needs a unique identification of each request to the server. In case the majority of servers are multithreaded and each new request is elaborated in a new flow, so the best suit for this will be thread identificator (tid). To add this unique identifier, e.g in Ruby on Rails framework you need to add only one line:

copy config.log_tags = [ :object_id ]

After this in each line of output logs, tid is output. It looks like this:

You can use RegExp to find tid gem: /^\[\d+\]/.

But if the tid output way differs you can set it:

For example if tid is located in curly brackets and not at the start of the line:

copy $ log_error_handler -t /\\{\\d+\\}/

In case this RegExp is written in the terminal, we need double screen version.

Gem finds out that the request has an error when finds the line which corresponds to RegExp of the error:

For example, we need to catch not only error 500 but also 404: copy $ log_error_handler -e "/(500)|(404).*error/i"



To look through values by default you need to type:

Time in settings by default is given in seconds.

The main time options:

Option " --not_modify_timeout" means time for the thread to finish writing logs in this file if the timeout expires, and during this time file will not be changed at least once, so the file is sent to the output, and if there are some errors it will be deleted.

means time for the thread to finish writing logs in this file if the timeout expires, and during this time file will not be changed at least once, so the file is sent to the output, and if there are some errors it will be deleted. Option " --log_file_tracker_waiting" means how often the checking cycle of temporary files in each thread will take place.

means how often the checking cycle of temporary files in each thread will take place. Option " --debug_mode" provides the data output in stdout about reading from stdin.

Log Error Handler Data Input

As it was mentioned above there are 3 ways of data input:

1.In stdout is performed by default, if none of the output parameters was indicated

2.In the file, if a parameter was indicated

For example: copy $ log_error_handler -f error.log

3.Into the network. For this one you need to indicate a parameter:

For example: copy $ log_error_handler -u https://app.geteasyqa.com/projects/upload_crashes

HTTP method post is used by default for data sending, but it can be easily replaced

For example:

copy $ log_error_handler -u https://app.geteasyqa.com/projects/upload_crashes -m put

Message is a key by default, under which error is located, so parameter is responsible for this value

For example: copy $ log_error_handler -u https://app.geteasyqa.com/projects/upload_crashes -m put -k error

If you need to send some additional parameters with an error so you can set them by means of options such as:

Or:

For example: copy $ log_error_handler -u https://app.geteasyqa.com/projects/upload_crashes -m put -k error -a "{\"token\":\"uQF7ZYtHh9VDMXBaJojq\"}"

Before sending all errors are encoded in Base64.

Bug reports and pull requests are welcome on GitHub at https://github.com/thinkmobiles/log_error_handler.

So, you've got more knowledge about this tool. Why not trying to use it? Hope, Log Error Handler will help you in your software development and testing process. It would be cool to know what you think about our tool. You can leave your remarks and wishes not only on GitHub, but also here below in the comments.