Solaris WBEM Services Administrator's Guide

Setting Logging Properties

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/ file.

Example 5-2 Setting Logging Properties

public class SetProps {
    public static void main(String args[]) throws CIMException {
	if ( args.length != 3) {
	    System.out.println("Usage: SetProps host username password"); 

	CIMClient cc = null;
	try {
	    CIMNameSpace cns = new CIMNameSpace(args[0]);
	    cc = new CIMClient(cns, args[1], args[2]);

	 	CIMObjectPath logpropcop = new CIMObjectPath("Solaris_Log
	    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"));
	catch (Exception e) {
	    System.out.println("Exception: "+e);

	// close session.
	if(cc != null) {