ilovetolearn
ilovetolearn

Reputation: 2060

I am not using freemarker for struts2, but I see lots of logging generated by freemarker

I am using struts 2 and jsp for my web application, but I am seeing a lot of freemarker debugging message generated on my console.

I have turn off the logging using slf4j and log4j2 configurations. However, looking deeper into the configurations.

It seems that freemarker is included in the struts-default package, and by extending it, I will include freemarker support in my web application as well.

Did I misconfigure my struts.xml configuration? Is disabling the output to console the only way to go?

How do I "remove" freemarker from my application?

my struts.xml

<package name="test" namespace="/" extends="struts-default">

struts-default.xml

<package name="struts-default" abstract="true" strict-method-invocation="true">
    <result-types>
        <result-type name="chain" class="com.opensymphony.xwork2.ActionChainResult"/>
        <result-type name="dispatcher" class="org.apache.struts2.result.ServletDispatcherResult" default="true"/>
        <result-type name="freemarker" class="org.apache.struts2.views.freemarker.FreemarkerResult"/>
        <result-type name="httpheader" class="org.apache.struts2.result.HttpHeaderResult"/>
        <result-type name="redirect" class="org.apache.struts2.result.ServletRedirectResult"/>
        <result-type name="redirectAction" class="org.apache.struts2.result.ServletActionRedirectResult"/>
        <result-type name="stream" class="org.apache.struts2.result.StreamResult"/>
        <result-type name="velocity" class="org.apache.struts2.result.VelocityResult"/>
        <result-type name="xslt" class="org.apache.struts2.views.xslt.XSLTResult"/>
        <result-type name="plainText" class="org.apache.struts2.result.PlainTextResult" />
        <result-type name="postback" class="org.apache.struts2.result.PostbackResult" />
    </result-types>

Upvotes: 0

Views: 622

Answers (1)

Andrea Ligios
Andrea Ligios

Reputation: 50281

Struts2 uses THEMEs to generate code from Struts tags;
a THEME is a collection of TEMPLATEs (one for each tag);
this TEMPLATEs (in struts2-core-xxx.jar -> template) are FreeMarker Templates.

Then you are not using Freemarker directly (for example in place of the JSPs), but Struts2 uses Freemarker implicitly, and you cannot remove it.


XY: your logging-pollution problem can be resolved by raising the server level to ERROR, and your application to DEBUG, instead of having the whole server to DEBUG.

Upvotes: 1

Related Questions