Static variable for debugging mode?

Hello I want to have a debugging mode for my application...
Its jsp, servlets..
If I have one static variable String called debug and set it to true then it should print all System.out. stuff in application... otherwise it shlould not...
Do I have ot have this static variable defined in every jsp and servlet?

try something like this
public Class AppControl{
public static boolean debugMode;
public static void setDebugMode(boolean flag){
this.debugMode = flag;
public static boolean ifDebug(){
return this.debugMode;
In your JSP just do
if (AppControl.isDebug()) {
//print debug
}

Similar Messages

  • Can not view contents of variable in debug mode (version 1.1.1.5.0)

    Hi
    I am running on WebLogic 11R1 and using OEPE 1.1.1.5.0.
    When Fast swap is enabled and I run WebLogic in debug mode using OEPE I can not view the contents of variables with the Eclipse debugger. I get the message "Expressions must contain either an expression or a block containing a well formed statement"
    However, if I disable Fast swap, i can view the variable within the Eclipse debugger
    Has anyone else had this problem?
    Regards
    Steve H

    Small correction... the soon-to-be-released version of WebLogic Server that Danny was referring to is 11gR1 PatchSet 2 or 10.3.3.

  • MySQL query works fine for Debug mode not during regular run mode

    Hello fellow Java gurus,
    I'm very much confused at the moment. I have an Java application that populates and accesses a MySQL database. It's a little complicated to explain but basically I've got a few threads that manipulate it. The database itself can handle multiple client connections.
    Now, my first SQL query determines whether records exist within a particular timeframe, since one of my columns is a time of arrival (toa). This works fine in debug and normal run mode. My second SQL query is only executed once the first query returns true, which occurs 100% of the time. The second query is very similar, however, has the very weird behaviour of working the way I want it during debugging mode, but doesn't work at all during normal run mode. I really do not understand. I've tried running the 2nd query using the same connection and also a different connection as to the 1st query but it really doesn't make a difference to the non-working outcome.
    If anyone has any ideas as to as to why this is happening, please help me. Any feedback would be greatly appreciated. I am desperate at the moment.
    Kind regards,
    Mitch.

    Sorry everyone, I've been able to solve it. My boolean variables were being set to their opposite values! Silly me.... cheers anyway....

  • How to use the dynamical or static variable for ESSBASE cube name?

    Hi Experts,
    When I import ESSBASE Cube into physical layer, the cube name from ESSBASE is created automatically, such as H_Sales.
    I want to use the the static or dynamical variable for replacing the external name. So I try to create the static variable in RPD,such as cubeName, and use the following code
    'VALUEOF(cubeName)' into the textbox of external name.
    However, when I view the report in answer, it will generate the error message: Database VALUEOF(cubeName) does not exist.
    Is it possible to implement this functionality?
    Thanks..

    Hi,
    use <%=odiRef.getSchemaName("D")%>
    D as parameter if it is the Data Schema or W if you need the schema from Work Schema
    Your command will be like:
    select <%=odiRef.getSchemaName("D")%>.GER_LOT_EXEC_ODI('Fluxo', 1, 'C') FROM DUAL
    Works?
    Cezar Santos
    http://odiexperts.com

  • What OCCI library to link to for debug mode in Instant Client 11.2.0.4?

    In the manual on OCCI it says that
    Applications that link to MSVCRTD.DLL, a debug version of Microsoft C-Runtime, /MDd compiler flag, should link with these specific OCCI libraries:oraocci11d.lib and oraocci11d.dll.
    However, Instant Client SDK version 11.2.0.4 does not contain either oraocci11d.lib or oraocci11d.dll, but only oraocci11.lib and oraocci11.dll. So what should I do to be able to run an OCCI application in Visual Studio in debug mode?
    Thanks,
    Rikke

    If I remember correctly, you may need to install the full Oracle client.

  • Can volatile variable be called as static variable for threads?

    I am trying to understand volatile variable, and it's uses. I was thinking of using it to make it shared variable between threads, but not between object instances.
    public class VolatileExample extends Thread {
      volatile int x = 1;
      public void f() {
           x++;
           System.out.println(Integer.toString(x));
        public void run() {
              for(int i = 0; i<20;i++){
                   f();
                   try { Thread.sleep(500); } catch(InterruptedException e) {}
        }now, if I create two threads in main method of the same VolatileExample class, say T1 and T2, how many times would volatile int x be instanciated? would there be just one copy of volatile int x created, no matter howmany threads I create?

    WHICH REMINDS ME: YOU DIDN'T ANSWER MY QUESTION AS TO
    WHETHER YOU UNDERSTAND THREADS' LOCAL COPIES OF
    VARIABLES VS. THE MAIN MEM COPYIn my understanding,
    local copies means each thread gets their own copy of a variable and they play with it separately. changing this variable in one thread does not chage value for another thread.
    main mem copy is the one accessed by all the threads. If one thread changes this value, it is reflected to all other threads using this variable.
    right?
    I tried using voaltile variable as shared variable like this:
    import java.io.*;
    public class VolatileIncrement {
      private int x = 1;
      public void f() {
           x++;
           System.out.println(Integer.toString(x));
      public String toString() { return Integer.toString(x); }
      class MakeThread extends Thread{
           public MakeThread(){
                System.out.println("starting MakeThread thread");
         public void run() {
              for(int i = 0; i<20;i++){
                   f();
                   try { Thread.sleep(500); } catch(InterruptedException e) {}
      public void createT() {
         Thread T2 = new MakeThread();
              T2.start();
         Thread T1 = new MakeThread();
              T1.start();
    }and created another class:
    import java.io.*;
    class TestVolatile
         public static void main(String[] args)
              VolatileIncrement vi = new VolatileIncrement();
              System.out.println("creating threads now...");
              vi.createT();
              System.out.println("Done Testing!!");
    }can this be called as correctly using non-static volatile variable as shared data?

  • Non-static variable cant accessed from the static context..your suggestion

    Once again stuck in my own thinking, As per my knowledge there is a general error in java.
    i.e. 'Non-static variable cant accessed from static context....'
    Now the thing is that, When we are declaring any variables(non-static) and trying to access it within the same method, Its working perfectly fine.
    i.e.
    public class trial{
    ���������� public static void main(String ar[]){      ////static context
    ������������ int counter=0; ///Non static variable
    ������������ for(;counter<10;) {
    �������������� counter++;
    �������������� System.out.println("Value of counter = " + counter) ; ///working fine
    �������������� }
    ���������� }
    Now the question is that if we are trying to declare a variable out-side the method (Non-static) , Then we defenately face the error' Non-static varialble can't accessed from the static context', BUT here within the static context we declared the non-static variable and accessed it perfectly.
    Please give your valuable suggestions.
    Thanks,
    Jeff

    Once again stuck in my own thinking, As per my
    knowledge there is a general error in java.
    i.e. 'Non-static variable cant accessed from static
    context....'
    Now the thing is that, When we are declaring any
    variables(non-static) and trying to access it within
    the same method, Its working perfectly fine.
    i.e.
    public class trial{
    ���������� public static void
    main(String ar[]){      ////static context
    ������������ int counter=0; ///Non
    static variable
    ������������ for(;counter<10;) {
    �������������� counter++;
    ��������������
    System.out.println("Value
    of counter = " + counter) ; ///working fine
    �������������� }
    ���������� }
    w the question is that if we are trying to declare a
    variable out-side the method (Non-static) , Then we
    defenately face the error' Non-static varialble can't
    accessed from the static context', BUT here within
    the static context we declared the non-static
    variable and accessed it perfectly.
    Please give your valuable suggestions.
    Thanks,
    JeffHi,
    You are declaring a variable inside a static method,
    that means you are opening a static scope... i.e. static block internally...
    whatever the variable you declare inside a static block... will be static by default, even if you didn't add static while declaring...
    But if you put ... it will be considered as redundant by compiler.
    More over, static context does not get "this" pointer...
    that's the reason we refer to any non-static variables declared outside of any methods... by creating an object... this gives "this" pointer to static method controller.

  • IS there static variables in oracle 9i??

    Hi,
    I have a requirement.
    I am establishing an orcale 9i connection from my .net application.
    Now I am calling an SP and it has a global count variable initialized to 0, and It fetches a count of * from one table and also there are other functionality that the SP does.
    Now I want to persisit this count variable's value , so that next time the SP is called ( in the same connection), I will make a check that if the count variable is not 0 then dont execute the query to populate the count variable.
    Normally in java, .net etc... we can create static variables for this purpose.
    Can the same be done in PL/SQL?
    If not what would be the alternative?
    Thanks folks.
    s

    Hi,
    Please have a look.
    SQL> create or replace package test_pkg
    2 is
    3 procedure test_1;
    4 end test_pkg;
    5 /
    Package created.
    SQL> create or replace package body test_pkg
    2 as
    3 global_cnt number(10):=0;
    4 procedure test_1
    5 is
    6 begin
    7 if global_cnt > 0
    8 then
    9 dbms_output.put_line('No RUN');
    10 else
    11 dbms_output.put_line('RUN');
    12 global_cnt := global_cnt + 1;
    13 end if;
    14 end;
    15 end test_pkg;
    16 /
    Package body created.
    SQL> set serveroutput on
    SQL> exec test_pkg.test_1
    RUN
    PL/SQL procedure successfully completed.
    SQL> exec test_pkg.test_1
    No RUN
    PL/SQL procedure successfully completed.
    SQL> exec test_pkg.test_1
    No RUN
    PL/SQL procedure successfully completed.
    SQL>
    -----------------------------------------------------------------------

  • Switch to debugging mode

    I need to debug my application, I've already set the debug mode ON as well as the restricted load balancing, but when I try to debug the application, it says that the j2ee engine server node should be in "Debugging", how can I change that??

    Hi Fran
    Where did you set the debug mode ON?
    How many instances of the J2EE you are running on the server?
    Clearly the error says that you have not started your J2EE engine for debug mode.
    If you have multiple instances see that you set the debug mode on on the instance where you have deployed
    Regards
    NagaKishore V

  • Variable not visible in debug mode

    Hi experts,
    i created a variable using a custom exit.
    i'v added to my query, but when launch debug mode, i can't see it in I_T_VAR_RANGE table;
    but i can see others created previously.
    is that normal? do i have to do something else?
    Thanks.
    Amine

    Hi Phani,
    Thanks for your answer.
    i think that i have an issue in y code, i got the following error:
    The function call of SLS_MISC_GET_LAST_DAY_OF_MONTH failed; a field may have been assigned to the parameter DAY_IN whose"
    here is my code:
    Can you tell me what's wrong please?
    DATA: temp_date like sy-datum.
    WHEN 'ZLASTDAYMONTH'.                
         if i_step = 2.
           LOOP AT I_T_VAR_RANGE INTO FISC_VAR_RANGE
                 WHERE VNAM = 'ZTODAYDATE2'.
             CLEAR L_S_RANGE.
             call function'SLS_MISC_GET_LAST_DAY_OF_MONTH'
           exporting
             day_in = FISC_VAR_RANGE-LOW     "this is the user entry date based on ZTODAYDATE2
             importing
             last_day_of_month = temp_date.
             L_S_RANGE-LOW      = temp_date.
             L_S_RANGE-SIGN        = 'I'.
             L_S_RANGE-OPT         = 'BT'.
             APPEND L_S_RANGE TO E_T_RANGE.
             EXIT.
           ENDLOOP.
         endif.

  • Global static variable. I just CANNOT get global for everything

    Hi,
    I copied a connection pool example from oracle web site. It uses static variable. Its not a servlet, its a javabean. I can run a million times in one session and everything is great. If I open up another session, it creates another instance and creates more connections when it should be seeing the previous instance.
    My question is how to make a static variable global to the entire application? Do i have to initialize it in the servlet container? All im doing is calling a JSP page which calls this bean. If instance is null, create 5 new connections. Well like i stated above, it works for a single session. It appears that each session gets its own instance. I have been working and debugging this for a long time and I just cannot come up with a solution...
    Any ideas???
    Thanks as always

    Declar it as static within the servlet class.
    public class MyServlet extends HttpServlet {
    public static ConnectionPool pool;
    Then you can access it from any JSP/Servlet using MyServlet.pool but you may have to import the class into the JSP/Servlet.
    Be aware that there may be synchroniztion issues when you access this static object so you may want to synchronize access to the pool.
      synchronized (application) {
           if (MyServlet.pool == null) { //initialize pool code here }

  • How to set debug mode in jdeveloper for SOA Suite

    Hello,
    Is possible to use jdeveloper, soa suite and debug mode? I can debug my web application with oc4j embendded server. But when i want to deploy on oracle application server and debug, doesnt work.
    How can i fix that?
    I saw that tutorials for jdeveloper and weblogic server, but not for oracle server.

    see :
    http://weblogs.asp.net/gsusx/archive/2006/06/01/WS_2D00_Addressing-interoperability-between-Oracle-BPEL-Process-Manager-and-Microsoft-Windows-Communication-Foundation.aspx
    http://dlimiter.wordpress.com/2009/11/16/manipulating-ws-addressing-headers-in-oracle-bpel/
    on how to populate the ws-addressing elements yourself
    basically you need to add the ws-addressing xsd, create a new variable of it, populate the elements and add it to your partnerlink

  • Using Static Variable against Context Attribute for Holding IWDView

    Dear Friends,
    I have a method which is in another DC which has a parameter of the type IWDView. In my view, I will have an action which will call the method in another component by passing the value for the view parameter. Here, I can achieve this in 2 types. One is - I declare a static variable and assign the wdDoModifyView's view as parameter value and I can pass this variable as parameter whenever calling that method or the second way - create an attribute and assign the same wdDoModifyView's view parameter as its value. Whenever I call this method, I can pass this attribute as parameter. What is the difference between these two types of holding the value since I am storing the same value i.e., wdDoModifyView's view parameter. But when I trigger the action from different user sessions, the first type of code (using static variable) prints the same value in both the sessions for view.hashCode() and View.toString(), but the same is printing the different values when I pass the attribute which holds the view parameter.
    Clarification on this is highly appreciated
    The problem I face is when I use static variable to get the view instance and export the data using the UI element's id, the data belonging to different user sessions is mixed up where as when I use Context Attribute, the same problem doesn't arise. I want to know the reason why it is so. Is there any other place or way where I can get the current view instance of each session instead of wdDoModifyView?

    Hi Sujai ,
    As you have specified the problem that we face when we use  static attributes, when end users are using the application .
    Static means i  have n number of objects but the static variable value will remain same every where.
    when it is context attribute for every object i.e nth object you have a nth context attribute i mean nth copy of the context attribute.
    so every user has a unique Iview parameter , when context is used and
    when static is used  , assume you have userA , his iview is set this intially  and u have another user B , when he is using  , since the variable is static and when you access this variable you will get the value of userA.
    Regards
    Govardan Raj

  • BO Webi: How to populate a variable with the set of static values for Graph

    Hi All,
    I have the data: Order number, Order Date, processing time coming from the SAP Bex query in the below format:
    Order No    Order Date    Processing time (Days)
    1                 Jan-2011      4
    2                 Jan-2011      5
    3                 Feb-2011      6
    In BO webi report, I have to report the number of orders which were processed in <1day, <2days, <3days,...<10days in a graphical view. i.e., X-Axis:  <1day, <2days, <3days,...<10days(10 static buckets for the processing days)
    Y-Axis: Number of Orders.
    The graphical output should be like below:
    X-Axis: <1day, <2days, <3days,<4days,<5days,<6days,<7days,<8days,<9days,<10days
    Y-Axis: 0, 0,0,0,1,2,3,3,3,3  (count(Order No)) (Cumulative count)
    I am able to calculate the number of orders individually for each of the 10 buckets. But the problem i am facing is that I am not able to hold the 10 static bucket values in a variable to use it for the x-axis in the Graph, as these 10 static bucket values are not coming from the backend source.
    I would like to know if there is way to populate a variable(to use it for the X-Axis in the graph) with the set of 10 static values.
    Any help would be highly appreciated.
    Thanks,
    Leela

    Hi ,
    I think we can use the variable as X-axis in chart.. but Variable Qulaification should be Dimension.
    can you try this?.
    Using efasion universe
    1) Select month and Sold at (unit price) , then run the query
    2) create the variable V_Month ==If [Month]=1 Then "Month1" Else "Month2"  (Note = Variable Qulaification should be Dimension)
    3) Create the variable V_Sum= sum (Sold at (unit price))
    4) create another variable V_Cumulative_Sum==[V_Sum]+Previous([V_Sum])
    Now add V_Month and V_Cumulative_Sum in table , then convert to chart.. now you can add the variable V_Month as X-axis of the chart.
    Hope this will help:)
    Thanks
    Ponnarasu K

  • How can we process the CRM Order again for second time in debugging mode

    Hi,
    Can anybody please tell me how can we process the CRM ORDER for second time.  that I want to process in debugging mode.
    Thanks,
    bsv

    Hi bsv,
    Are you trying to reprocess a BDOC for debugging purpose?
    If the BDOC is not with a final status, you will be able to reprocess it using the reprocess button in the smw01 search result list.
    And you may put /h on the popup when you click on the 'reprocess' button.
    If it is allowed to make some changes in the CRM ORDER for testin purpose, it would be easier to perform debugging.
    A more 'careless' way is to deactivate the outbound or inbound queue in transaction smqs or smqr, then in smq1 or smq2 to locate the interested queue, and click on button 'debug LUW'.
    Hongyan

Maybe you are looking for