[jira] Created: (VELOCITY-621) Update to SLF4J or workaround?

View: New views
5 Messages — Rating Filter:   Alert me  

[jira] Created: (VELOCITY-621) Update to SLF4J or workaround?

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Update to SLF4J or workaround?
------------------------------

                 Key: VELOCITY-621
                 URL: https://issues.apache.org/jira/browse/VELOCITY-621
             Project: Velocity
          Issue Type: Improvement
          Components: Engine
    Affects Versions: 1.5, 1.4
            Reporter: SebastianWagner


I know that it has been discussed one year ago in  VELOCITY-392

but there is need for at least a workaround for people who are forced to use slf4j.
For example other frameworks did already switch like Hibernate.
So there is now definitely need for something to enable Velocity to run without errors in a environment with log4j-over-slf4j.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-621) Update to SLF4J or workaround?

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637533#action_12637533 ]

SebastianWagner commented on VELOCITY-621:
------------------------------------------

At the moment you get errors like:

DEBUG] [pool-4-thread-16] org.apache.velocity - CommonsLogLogChute name is 'org.apache.velocity'
[DEBUG] [pool-4-thread-16] org.apache.velocity - Starting Apache Velocity v1.6-dev (compiled: 2007-04-04 11:16:14)
[DEBUG] [pool-4-thread-16] org.apache.velocity - Default Properties File: org/apache/velocity/runtime/defaults/velocity.properties
[DEBUG] [pool-4-thread-16] org.apache.velocity - Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
[DEBUG] [pool-4-thread-16] org.apache.velocity - Target log system for org.apache.velocity.runtime.log.AvalonLogChute is not available (java.lang.NoClassDefFoundError: org/apache/log/format/Formatter).  Falling back to next log system...
[DEBUG] [pool-4-thread-16] org.apache.velocity - Trying to use logger class org.apache.velocity.runtime.log.Log4JLogChute
[DEBUG] [pool-4-thread-16] org.apache.velocity - Target log system for org.apache.velocity.runtime.log.Log4JLogChute is not available (java.lang.NoClassDefFoundError: org/apache/log4j/Appender).  Falling back to next log system...
[DEBUG] [pool-4-thread-16] org.apache.velocity - Trying to use logger class org.apache.velocity.runtime.log.JdkLogChute
[INFO] [pool-4-thread-16] org.apache.velocity - Failed to initialize an instance of org.apache.velocity.runtime.log.JdkLogChute with the current runtime configuration.
java.lang.IllegalArgumentException: Bad level "WARN"
        at java.util.logging.Level.parse(Level.java:336)
        at org.apache.velocity.runtime.log.JdkLogChute.init(JdkLogChute.java:65)
        at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:150)
        at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:243)
        at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:728)
        at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:240)
        at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:548)
        at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:241)
        at org.apache.velocity.app.Velocity.init(Velocity.java:97)
        at org.openmeetings.app.templates.VelocityLoader.<init>(Unknown Source)
        at org.openmeetings.app.templates.RegisterUserTemplate.<init>(Unknown Source)
        at org.openmeetings.app.templates.RegisterUserTemplate.getInstance(Unknown Source)
        at org.openmeetings.app.data.user.Emailmanagement.sendMail(Unknown Source)
        at org.openmeetings.app.data.user.Usermanagement.registerUserInit(Unknown Source)
        at org.openmeetings.app.data.user.Usermanagement.registerUser(Unknown Source)
        at org.openmeetings.app.remote.MainService.registerUserByObject(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:201)
        at org.red5.server.service.ServiceInvoker.invoke(ServiceInvoker.java:119)
        at org.red5.server.net.rtmp.RTMPHandler.invokeCall(RTMPHandler.java:158)
        at org.red5.server.net.rtmp.RTMPHandler.onInvoke(RTMPHandler.java:410)
        at org.red5.server.net.rtmp.BaseRTMPHandler.messageReceived(BaseRTMPHandler.java:146)
        at org.red5.server.net.rtmp.RTMPMinaIoHandler.messageReceived(RTMPMinaIoHandler.java:126)
        at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570)
        at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299)
        at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53)
        at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648)
        at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220)
        at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:613)


> Update to SLF4J or workaround?
> ------------------------------
>
>                 Key: VELOCITY-621
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-621
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.4, 1.5
>            Reporter: SebastianWagner
>
> I know that it has been discussed one year ago in  VELOCITY-392
> but there is need for at least a workaround for people who are forced to use slf4j.
> For example other frameworks did already switch like Hibernate.
> So there is now definitely need for something to enable Velocity to run without errors in a environment with log4j-over-slf4j.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-621) Update to SLF4J or workaround?

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637542#action_12637542 ]

Claude Brisson commented on VELOCITY-621:
-----------------------------------------

I don't know slf4j, but all you need to do is create a Slf4jLogChute bridge class that implements org.apache.velocity.runtime.log.LogChute.

Then, you can put the following in your velocity.properties:

  runtime.log.logsystem.class=your_class_name
  runtime.log.slf4j.your_custom_property=whatever

You can read the value of the custom property (the loglevel, for instance) in the LogChute.init() method using:

  String value = rs.getString("runtime.log.slf4j.your_custom_property");

(btw, the exception you see is fixed in the upcoming 1.6 release, but anyway you don't get it if you explicitely define a logger)


> Update to SLF4J or workaround?
> ------------------------------
>
>                 Key: VELOCITY-621
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-621
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.4, 1.5
>            Reporter: SebastianWagner
>
> I know that it has been discussed one year ago in  VELOCITY-392
> but there is need for at least a workaround for people who are forced to use slf4j.
> For example other frameworks did already switch like Hibernate.
> So there is now definitely need for something to enable Velocity to run without errors in a environment with log4j-over-slf4j.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-621) Update to SLF4J or workaround?

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12637544#action_12637544 ]

Nathan Bubna commented on VELOCITY-621:
---------------------------------------

This error has been fixed since 1.6-beta1 was released.   What happens if you use a more recent build from the trunk?  If you don't want to check it out and build it yourself, i put one up here:

http://people.apache.org/~nbubna/velocity/engine/1.6-dev/

> Update to SLF4J or workaround?
> ------------------------------
>
>                 Key: VELOCITY-621
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-621
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.4, 1.5
>            Reporter: SebastianWagner
>
> I know that it has been discussed one year ago in  VELOCITY-392
> but there is need for at least a workaround for people who are forced to use slf4j.
> For example other frameworks did already switch like Hibernate.
> So there is now definitely need for something to enable Velocity to run without errors in a environment with log4j-over-slf4j.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


[jira] Commented: (VELOCITY-621) Update to SLF4J or workaround?

by Velocity - Dev mailing list-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


    [ https://issues.apache.org/jira/browse/VELOCITY-621?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12718315#action_12718315 ]

Wim Deblauwe commented on VELOCITY-621:
---------------------------------------

I am using slf4j with Velocity. I just implemented {{LogChute}} interface as follows:

{code}
        private static class Slf4jLogChute implements LogChute
        {
                @Override
                public void init( RuntimeServices runtimeServices ) throws Exception
                {
                }

                @Override
                public void log( int level, String message )
                {
                        switch (level)
                        {
                                case DEBUG_ID:
                                        logger.debug( message );
                                        break;
                                case INFO_ID:
                                        logger.info( message );
                                        break;
                                case WARN_ID:
                                        logger.warn( message );
                                        break;
                                case ERROR_ID:
                                        logger.error( message );
                                        break;
                        }
                }

                @Override
                public void log( int level, String message, Throwable throwable )
                {
                        switch (level)
                        {
                                case DEBUG_ID:
                                        logger.debug( message, throwable );
                                        break;
                                case INFO_ID:
                                        logger.info( message, throwable );
                                        break;
                                case WARN_ID:
                                        logger.warn( message, throwable );
                                        break;
                                case ERROR_ID:
                                        logger.error( message, throwable );
                                        break;
                        }
                }

                @Override
                public boolean isLevelEnabled( int level )
                {
                        boolean result = false;
                        switch (level)
                        {
                                case DEBUG_ID:
                                        result = logger.isDebugEnabled();
                                        break;
                                case INFO_ID:
                                        result = logger.isInfoEnabled();
                                        break;
                                case WARN_ID:
                                        result = logger.isWarnEnabled();
                                        break;
                                case ERROR_ID:
                                        result = logger.isErrorEnabled();
                                        break;
                        }
                        return result;
                }
        }
{code}

Where {{logger}} is an slf4j Logger.

> Update to SLF4J or workaround?
> ------------------------------
>
>                 Key: VELOCITY-621
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-621
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>    Affects Versions: 1.4, 1.5
>            Reporter: SebastianWagner
>
> I know that it has been discussed one year ago in  VELOCITY-392
> but there is need for at least a workaround for people who are forced to use slf4j.
> For example other frameworks did already switch like Hibernate.
> So there is now definitely need for something to enable Velocity to run without errors in a environment with log4j-over-slf4j.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...