Start a new topic

GAE logs all my BL code

I linked a GAE app to a Custom Endpoint.

Every time I send a request to this Custom Endpoint (and of course the request goes to the GAE app), the app logs all my BL code.

It's quite a long log each time :D

Is this my fault or is it something that automatically happens?

Can I disable this?





** I created my GAE application starting from the sample "quickstart" that is in Kinvey BL SDK. **

all I do about logging is to import the logger

import java.util.logging.Logger;



initialize it:

public class Resize {

public final static Logger LOGGER = Logger.getLogger(Resize.class.getName());

...



and use it a few times like this:

LOGGER.info("fileUrl: " + fileUrl);




Okay, cool, found the solution.

It was simple if I only knew more about Java web apps :)



Just need to delete the "com.sun.jersey.api.container.filter.LoggingFilter" reference from "ContainerRequestFilters" param on web.xml, cause I only want to read logs from the response, but I'm not interested in logging the whole request.

Yep, it is logged on GAE -- sorry I realize I didn't specify where the data was logged.

But that makes it confusing for me to find any custom log I want to have and quickly fills up my Log storage space.

Is there a way to hinder the app to log the whole request?



I'll try deleting some element from web.xml and see what happens :D
That info is the data that is passed in the request, which I believe is logged in app engine.
actually, now that I read my post I realize that the log starts with LoggingFilter, that is exactly what's in the web.xml

I don't really know what that is or how it works, cause I used the default web.xml .... this is the code of that file:



<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee

http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

version="2.5">



<display-name>Kinvey External Business Logic Quickstart</display-name>

<servlet>

<servlet-name>k-ca</servlet-name>

<servlet-class>

com.sun.jersey.spi.container.servlet.ServletContainer

</servlet-class>

<init-param>

<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>

<param-value>com.sun.jersey.api.container.filter.LoggingFilter;com.kinvey.business_logic.interceptors.KinveyAuthInterceptor</param-value>

</init-param>

<init-param>

<param-name>com.sun.jersey.spi.container.ContainerResponseFilters</param-name>

<param-value>com.sun.jersey.api.container.filter.LoggingFilter</param-value>

</init-param>

<init-param>

<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>

<param-value>true</param-value>

</init-param>

<init-param>

<param-name>com.sun.jersey.config.property.packages</param-name>

<param-value>com.fasterxml.jackson.jaxrs;com.kinvey.collection_access</param-value>

</init-param>

<load-on-startup>1</load-on-startup>

</servlet>

<listener>

<listener-class>com.kinvey.collection_access.AppConfiguration</listener-class>

</listener>

<servlet-mapping>

<servlet-name>k-ca</servlet-name>

<url-pattern>/*</url-pattern>

</servlet-mapping>

</web-app>





You can see LoggingFilter as value in the first 2 init-params

Should I take one of those 2 init-param off the servlet?
hmm, okay so it's not something that happens by default...



On that file I have no other log with "LOGGER", if not a LOGGER.info("Done.");

I don't know if there's other ways to log and I accidentally wrote that without realizing it...but I don't think so.



In AppConfiguration.java I have the only other log:



...

public class AppConfiguration implements ServletContextListener {

private final static Logger LOGGER = Logger.getLogger(AppConfiguration.class.getName());

...

LOGGER.info("App is being configured.");

...



And then I have something on web.xml about "LoggingFilter" ...but that's just some parameter and it was there by default.



Studying a bit the log I realized it's all part of something that basically logs my request, in a very extended way: there's headers, body, authorization, but also a big part containing all my Kinvey account parameters... and within these, under "arguments"."bl" I have listed all my BL code.



This is how my logs look like on GAE:

(I was wrong saying it doesn't log my logs...cause I realized it actually does, I just had a hard time finding them ;) )



com.sun.jersey.api.container.filter.LoggingFilter filter: 2 * Server in-bound request

2 > POST http://xxxxxxxxxx.appspot.com/resize/customEndpoint

2 > Accept: /

2 > Host: xxxxxxxx.appspot.com

2 > Content-Type: application/json

2 > Authorization: Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

2 > Content-Length: 62787

2 > User-Agent: Restler for node.js

2 > X-AppEngine-Country: ZZ

2 >

{

"arguments": {

"appId": "kid_xxxxxxxxxx",

"appMetadata": {

"API_version": 3,

"id": "kidxxxxxxxxxx",

"acl": {

"_customEndpoints": {

"test": "master-or-user",

"newChallenge": "master-or-user",



... many other similar ones ...



"getPostComments": "master-or-user",

"editGroup": "master-or-user"

},

"ErrorsLog": "append-read",

"Media": "append-read",



... many other similar ones ...



"UserInfo": "append-read",

"PostComment": "append-read"

},

"appId": "xxxxxxxxxxxxxxxxxxxxxxxx",

"appsecret": "xxxxxxxxxxxxxxxxxxxxxx",

"billing": {

"payment_method_id": null

},

"bl": {

"_custom": {

"endpoint-1": {"code": " ........ here all the code of my custom endpoint that here I called endoint-1 "},

"endpoint-2":{"code": " ........ here all the code of my custom endpoint that here I called endoint-2 "},



...... and so on with all the endpoints



},

"notification ":{},

" collection-1 ": {"

hasOnPreSave ":true,"

hasOnPreFetch ":true,"

...

code ":" ..... here all the code of the different hooks for collection-1"



... and then basically it goes on with the other collections, and other parameters about my

Kinvey account, the request body, headers, response, etc.



... and after all of this I have my log "Done."





What else are you logging? It doesn't seem like the above would cause it.
Login or Signup to post a comment