You can create an instance of the Solaris_LogServiceProperties class and set property values for the instance to control how your application or provider handles logging. The following code example shows how to set logging properties. Properties are stored in the /usr/sadm/lib/wbem/WbemServices.properties file.
public class SetProps { public static void main(String args[]) throws CIMException { if ( args.length != 3) { System.out.println("Usage: SetProps host username password"); System.exit(1); } CIMClient cc = null; try { CIMNameSpace cns = new CIMNameSpace(args[0]); cc = new CIMClient(cns, args[1], args[2]); CIMObjectPath logpropcop = new CIMObjectPath("Solaris_Log ServiceProperties"); Enumeration e = cc.enumInstances(logpropcop, true); for (; e.hasMoreElements(); ) { CIMObjectPath op = (CIMObjectPath)e.nextElement(); CIMInstance ci = cc.getInstance(op); ci.setProperty("Directory", new CIMValue("/tmp/bar1/")); ci.setProperty("FileSize", new CIMValue("10")); ci.setProperty("NumFiles", new CIMValue("2")); ci.setProperty("SyslogSwitch", new CIMValue("off")); cc.setInstance(logpropcop,ci); } } catch (Exception e) { System.out.println("Exception: "+e); e.printStackTrace(); } // close session. if(cc != null) { cc.close(); } } |