|
Externalize all logging messages level INFO, WARN, SEVERE. These messages are not designed for end user outward facing but rather for supporting/debugging the framework.
1. org.apache.shindig.common.logging.i18n.MessageKeys: Unique [key, value] pairs for i18n logging messages. The key is used as message key input in the log method and its value matched the key specified in the localized resource.properties file
2. shindig-common/src/main/resources/org/apache/shindig/common/logging/i18n/resource.properties: is used for localization of messages. We'll keep the logging messages in this file, and we'll use the keys declared in the MessageKeys to access them.
3. Examples:
* Create a logger with the MessageKey attached:
//class name for logging purpose
private static final String classname = "org.apache.shindig.auth.AuthenticationServletFilter";
private static final Logger LOG = Logger.getLogger(classname,MessageKeys.MESSAGES);
* Using Java logp and message key for logging message with i18n support. Make sure to add the keys in MessageKeys, and the localized logging text in the resource.properties file.
if (LOG.isLoggable(Level.INFO)) {
LOG.logp(Level.INFO, classname, "doFilter", MessageKeys.ERROR_PARSING_SECURE_TOKEN, cause);
}
* Here's a simple example for compound message using template:
if (LOG.isLoggable(Level.INFO)) {
LOG.logp(Level.INFO, classname, "loadDefaultKey", MessageKeys.LOAD_KEY_FILE_FROM, new Object[] {signingKeyFile});
}
"signingKeyFile" is the variable that will be inserted into the "couldNotLoadKeyFile" template text in the resource.properties, replacing {0} below. The number 0 is the array index of the variable of new Object[] {signingKeyFile}, you can add as many arguments to the the array as needed, then reference them using their indexes in the text template.
couldNotLoadKeyFile=Couldn't load key file {0}
* The localized text in the resouce.properties is a 1 liner, to add a new line, just add \n at the end of the sentence. Other text formatting is in similar fashion. Here's an example of logging text in the resource.properties file with newline feed
couldNotLoadSignedKey=Couldn''t load OAuth signing key. To create a key, run:\n openssl req -newkey rsa:1024 -days 365 -nodes -x509 -keyout testkey.pem \\\n -out testkey.pem -subj '/CN=mytestkey'\n openssl pkcs8 -in testkey.pem -out oauthkey.pem -topk8 -nocrypt -outform PEM\n\n Then edit shindig.properties and add these lines:\n {0} =<path-to-oauthkey.pem>\n {1} =mykey\n
|
Unified diffs |
Side-by-side diffs |
Delta from patch set |
Stats (+823 lines, -203 lines) |
Patch |
|
|
java/common/src/main/java/org/apache/shindig/auth/AuthenticationServletFilter.java
|
View
|
|
5 chunks |
+19 lines, -8 lines |
0 comments
|
Download
|
|
|
java/common/src/main/java/org/apache/shindig/common/cache/LruCacheProvider.java
|
View
|
|
3 chunks |
+10 lines, -3 lines |
0 comments
|
Download
|
|
|
java/common/src/main/java/org/apache/shindig/common/logging/i18n/MessageKeys.java
|
View
|
|
1 chunk |
+147 lines, -0 lines |
0 comments
|
Download
|
|
|
java/common/src/main/java/org/apache/shindig/common/xml/XmlUtil.java
|
View
|
|
6 chunks |
+27 lines, -10 lines |
0 comments
|
Download
|
|
|
java/common/src/main/java/org/apache/shindig/config/DynamicConfigProperty.java
|
View
|
|
3 chunks |
+9 lines, -2 lines |
0 comments
|
Download
|
|
|
java/common/src/main/java/org/apache/shindig/config/JsonContainerConfigLoader.java
|
View
|
|
6 chunks |
+18 lines, -6 lines |
0 comments
|
Download
|
|
|
java/common/src/main/java/org/apache/shindig/protocol/ApiServlet.java
|
View
|
|
3 chunks |
+9 lines, -4 lines |
0 comments
|
Download
|
|
|
java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanAtomConverter.java
|
View
|
|
1 chunk |
+1 line, -0 lines |
0 comments
|
Download
|
|
|
java/common/src/main/resources/org/apache/shindig/common/logging/i18n/resource.properties
|
View
|
|
1 chunk |
+172 lines, -0 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/AbstractSpecFactory.java
|
View
|
|
3 chunks |
+10 lines, -3 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/HashLockedDomainService.java
|
View
|
|
4 chunks |
+9 lines, -2 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureRegistry.java
|
View
|
|
5 chunks |
+12 lines, -8 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/features/FeatureResourceLoader.java
|
View
|
|
4 chunks |
+15 lines, -5 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
|
View
|
|
4 chunks |
+16 lines, -8 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponseMetadataHelper.java
|
View
|
|
3 chunks |
+12 lines, -5 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthModule.java
|
View
|
|
5 chunks |
+25 lines, -13 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java
|
View
|
|
7 chunks |
+14 lines, -7 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthResponseParams.java
|
View
|
|
2 chunks |
+10 lines, -9 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/GadgetHtmlParser.java
|
View
|
|
4 chunks |
+9 lines, -2 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/caja/CajaCssSanitizer.java
|
View
|
|
4 chunks |
+13 lines, -5 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/preload/PipelineExecutor.java
|
View
|
|
3 chunks |
+9 lines, -2 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/process/Processor.java
|
View
|
|
4 chunks |
+8 lines, -2 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/CajaResponseRewriter.java
|
View
|
|
4 chunks |
+12 lines, -4 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/DefaultServiceFetcher.java
|
View
|
|
3 chunks |
+13 lines, -7 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/Renderer.java
|
View
|
|
4 chunks |
+13 lines, -6 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/RenderingGadgetRewriter.java
|
View
|
|
4 chunks |
+12 lines, -4 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/render/SanitizingResponseRewriter.java
|
View
|
|
5 chunks |
+18 lines, -11 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/CssResponseRewriter.java
|
View
|
|
4 chunks |
+10 lines, -5 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ImageAttributeRewriter.java
|
View
|
|
5 chunks |
+17 lines, -5 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/MutableContent.java
|
View
|
|
3 chunks |
+8 lines, -2 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/PipelineDataGadgetRewriter.java
|
View
|
|
3 chunks |
+9 lines, -3 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ProxyingVisitor.java
|
View
|
|
3 chunks |
+9 lines, -3 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/TemplateRewriter.java
|
View
|
|
3 chunks |
+9 lines, -2 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/image/BasicImageRewriter.java
|
View
|
|
3 chunks |
+13 lines, -4 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/CajaContentRewriter.java
|
View
|
|
9 chunks |
+23 lines, -8 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ConcatProxyServlet.java
|
View
|
|
6 chunks |
+11 lines, -7 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/GadgetRenderingServlet.java
|
View
|
|
4 chunks |
+8 lines, -2 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/ProxyServlet.java
|
View
|
|
4 chunks |
+8 lines, -1 line |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/servlet/RpcServlet.java
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/templates/DefaultTemplateProcessor.java
|
View
|
|
3 chunks |
+9 lines, -4 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/main/java/org/apache/shindig/gadgets/uri/UriUtils.java
|
View
|
|
4 chunks |
+8 lines, -2 lines |
0 comments
|
Download
|
|
|
java/gadgets/src/test/java/org/apache/shindig/gadgets/oauth/OAuthRequestTest.java
|
View
|
|
1 chunk |
+1 line, -1 line |
0 comments
|
Download
|
|
|
java/gadgets/src/test/java/org/apache/shindig/gadgets/oauth/OAuthResponseParamsTest.java
|
View
|
|
1 chunk |
+2 lines, -2 lines |
0 comments
|
Download
|
|
|
java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/eclipselink/Bootstrap.java
|
View
|
|
3 chunks |
+9 lines, -3 lines |
0 comments
|
Download
|
|
|
java/samples/src/main/java/org/apache/shindig/social/opensocial/jpa/hibernate/Bootstrap.java
|
View
|
|
3 chunks |
+9 lines, -3 lines |
0 comments
|
Download
|
|
|
java/social-api/src/test/java/org/apache/shindig/social/opensocial/util/XSDValidator.java
|
View
|
|
5 chunks |
+17 lines, -9 lines |
0 comments
|
Download
|
Total messages: 1
|