Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Is it possible to get stdout from GSC?

We are working with 3rd party library within our PU's. It has a nasty feature of writing important information about internal failures into stdout only. Is it possible to log stdout from GSC's somewhere like GSA to be able to debug problems like that?

asked 2014-10-06 12:29:20 -0500

aliher1911 gravatar image

updated 2014-10-06 13:22:25 -0500

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

Hi, In version 10.1 we are changing the logging framework. Meanwhile, you can write your own handler (see more information here: http://docs.gigaspaces.com/xap97adm/l... ) For production readiness, i suggest you open a support case, to have the support team review your solution. Thanks, Inbar

answered 2014-10-14 03:59:35 -0500

inbarc gravatar image
edit flag offensive delete link more
0

If I had that problem, I might do something like this:

Write a debug-scoped Spring Bean declared in my context descriptor that does the following:

@Component
public class DebugScopedBean{

       @Resource
       private StdOutToJavaUtilLoggingAdaptor adaptor;
       private OutputStream original = System.out;

       public void init(){
          System.setOut(adaptor);
       }

       public void destroy(){
          System.setOut(original);
       }

    }

@Component class StdOutToJavaUtilLoggingAdaptor extends OutputStream{

       private static final char ENDLINE = ...
       private final StringBuffer buff = new StringBuffer();
       private final Logger destinationLogger = ...

       @Override
       public void write(char c){
          if( c == ENDLINE ){
              destinationLogger.debug(buff.toString());
              buff = new StringBuffer(); // or whatever, depending upon threadyness
          }
          else buff.append(c);
       }

    }

Please understand that this is not a suggestion for production code and may have unintended side-effects in other test code if your tests are not managed and terminated appropriately. But it should work.

answered 2014-10-07 08:39:56 -0500

jasonnerothin gravatar image
edit flag offensive delete link more

Comments

I need a production quality solution, not a test one. Gigaspace itself overrides system out to capture outofmemory errors. If we remove that stdout then we may loose capability of autorestart on OOM. So it will require deploying something on every gsc which is not directly supported.

aliher1911 gravatar imagealiher1911 ( 2014-10-13 09:50:22 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-10-06 12:29:20 -0500

Seen: 80 times

Last updated: Oct 14 '14