You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Ceki Gülcü <ce...@qos.ch> on 2005/02/01 13:56:55 UTC

RE: [NEW] Log4j Boolean Expression Language (LBEL)

Hello Scott,

Java does not have operators such as >, >=, <, <= for comparing
strings. So using java's logical operators &&, || and ! is not
consistent with the rest of the expression language (using >, etc.).

 From what I can tell so far, there is an almost 1 to 1 mapping between
boolean expressions for evaluating logging events and an SQL
expressions on an imaginary LOGGING_EVENT table, (assuming a
LoggingEvent table with columns timestamp, thread, logger, class,
method, message fields existed).

A sample SQL SELECT query on LOGGING_EVENT table looks like:

   SELECT * FROM LOGGING_EVENT WHERE logger = org.wombat AND method = foo;

In LBEL, the "FROM LOGGING_EVENT" part is implicit because log4j boolean
expressions are always relative to an event. In LBEL, the above SQL
select becomes:

   logger = org.wombat AND method = getPaper

Of course, there are differences. An SQL SELECT can return several
rows and columns whereas log4j boolean expressions only return true or
false.

The syntax of LBEL is heavily inspired from SQL. LBEL tries to adhere
to SQL conventions as much as possible which is one of the reasons why
keywords are case insensitive, and the operators AND, OR, NOT are used
instead of &&, ||, !.

At 09:32 PM 1/26/2005, Scott Deboy wrote:
>This is a timely message, I've already written the lexer for the 
>keywords/operators supported by ExpressionRule and I was about to write 
>the parser.
>
>This is very similar to ExpressionRule and its reliance on all of the 
>rules in the o.a.l.rule package (of course).
>
>I was going to do something very similar, and delegate the parser actions 
>to the rules in the rule package.
>
>Similarities to current expressionRule:
>
>Some syntactic minor differences
>AND/OR instead of &&/||, ~ instead of LIKE for regular expressions.

With support for the pattern match operator there is no need for the
LIKE operator is there?

>AndRule already doesn't evaluate the right hand side of the rule.
>
>What is !~?

!~ is the opposite of ~.


-- 
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: [NEW] Log4j Boolean Expression Language (LBEL)

Posted by Paul Smith <ps...@aconex.com>.
> With support for the pattern match operator there is no need for the
> LIKE operator is there?
>

If we're going to make this language as similar to SQL as possible, then 
we should support LIKE, because that's in SQL definition. Admittedly, it 
functions very similarly to the pattern match operator, however I would 
really love to have LIKE in there, maybe just for completeness, and I do 
think it 'reads' better for the the simple pattern matching use cases 
that Like supports. ("logger LIKE '%foo%'....")

Just my 5c AUD worth (~ 3c US).

>

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org